/**************************************************************************** Copyright (c) 2011-2013,WebJet Business Division,CYOU http://www.genesis-3d.com.cn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ using System; using System.Runtime.CompilerServices; using ScriptRuntime; namespace ScriptRuntime { /// /// 一个管理游戏中所有Actor的类。 /// public static partial class ActorManager { /// /// 通过Template创建一个Actor. /// /// Template的路径. /// 是否拷贝Template,默认为False. /// 创建出来的Actor. static public Actor CreateFromTemplate(String name, bool bCopy) { return ICall_ActorManager_CreateFromTemplate(name,bCopy); } /// /// 通过Template创建一个Actor. /// /// Template的路径. /// 创建出来的Actor. static public Actor CreateFromTemplate(String name) { return ICall_ActorManager_CreateFromTemplate(name, false); } /// /// 通过Index获取当前活动的Actor。 /// /// Index值. /// Index对应的活动Actor. /**@brief示例 *@code{.cpp} int iCount = ActorManager.GetActiveActorCount(); if (0 < iCount) { Actor actor = ActorManager.GetActiveActor(0); } @endcode */ static public Actor GetActiveActor(int index) { return ICall_ActorManager_GetActiveActor(index); } /// /// 获取当前活动的Actor数目. /// /// 当前活动的Actor数目. /**@brief示例 *@code{.cpp} int iCount = ActorManager.GetActiveActorCount(); if (0 < iCount) { Actor actor = ActorManager.GetActiveActor(0); } @endcode */ static public int GetActiveActorCount() { return ICall_ActorManager_GetActiveActorCount(); } /// /// 通过ActorID获取Actor. /// /// Actor的ActorID. /// 被找到的Actor. static public Actor FindActiveActor(uint fastID) { return ICall_ActorManager_FindActiveActorByFastID(fastID); } /// /// 通过标签找到标签为tagID的第一个Actor. /// /// 标签ID. /// 被找到的第一个Actor. static public Actor FindActiveActorInGroup(uint tagID) { return ICall_ActorManager_FindActiveActorInGroup(tagID); } /// /// 通过标签找到所有标签为tagID的Actor. /// /// 标签ID. /// 被找到的所有Actor. static public Actor[] FindActiveActorsInGroup(uint tagID) { return ICall_ActorManager_FindActiveActorsInGroup(tagID); } /// /// 通过GUID找Actor. /// /// GUID /// 被找到的Actor. static public Actor FindActiveActor(Guid guid) { byte[] guidarray = guid.ToByteArray(); return ICall_ActorManager_FindActiveActorByGuid(guidarray); } /// /// 通过名字查找Actor. /// /// 名字 /// 被找到的Actor. /**@brief示例 *@code{.cpp} Actor actor = ActorManager.FindActiveActor("test"); if (null != actor) { ScriptRuntime.Debug.Printf("ActorManager.FindActiveActor"); } @endcode */ static public Actor FindActiveActor(String name) { return ICall_ActorManager_FindActiveActorByName(name); } /// /// 获取主摄像机. /// /// 主摄像机的Actor. /**@brief示例 *@code{.cpp} Actor actor = ActorManager.MainCameraActor; @endcode */ static public Actor MainCameraActor { get { return ICall_ActorManager_GetMainCameraActor(); } } } }