public void AddActor(Actor actor)
 {
     if (m_ActorDict != null
         && !m_ActorDict.ContainsKey(actor.Id))
     {
         m_ActorDict.Add(actor.Id, actor);
     }
 }
        public void Init(Actor actor, ScriptData data)
        {
            string binPath = System.Environment.CurrentDirectory;
            string dllPath = binPath + "\\" + data.m_ScriptLib;
            string typeName = string.Format("RuntimeScript.{0}", data.m_ScriptClass);

            m_Assembly  = Assembly.LoadFile(dllPath);
            m_ScriptType = m_Assembly.GetType(typeName);
            m_ScriptClass = (ScriptClass)Activator.CreateInstance(m_ScriptType);

            m_ScriptRoot_OnActive = m_ScriptType.GetMethod("OnActive");
            m_ScriptRoot_OnLoad = m_ScriptType.GetMethod("OnLoad");
            m_ScriptRoot_OnBeginFrame = m_ScriptType.GetMethod("OnBeginFrame");
            m_ScriptRoot_OnFrame = m_ScriptType.GetMethod("OnFrame");
            m_ScriptRoot_OnEndFrame = m_ScriptType.GetMethod("OnEndFrame");
            m_ScriptRoot_OnDeactive = m_ScriptType.GetMethod("OnDeactive");

            Name = actor.Name;
            Owner = actor;

            m_ScriptClass.Instance = this;
        }
        public static Actor LoadFromTemplate(string template)
        {
            Actor actor = new Actor();

            string binPath = System.Environment.CurrentDirectory;
            string filePath = string.Format("{0}\\..\\..\\Asset\\ActorTemplate\\{1}.{2}", binPath, template, "xml");

            ActorData data = ConfigParser.ParserScript(filePath);

            ScriptData scriptData = new ScriptData();
            scriptData.m_ScriptClass = "Script_PlayerSelf";
            scriptData.m_ScriptLib = "UserDef.dll";

            ActorData actorData = new ActorData();
            actorData.Name = "PlayerSelf";
            actorData.TemplateName = "PlayerSelf";
            actorData.AddScriptData(scriptData);

            actor.Load(actorData);

            ActorManager.Instance.AddActor(actor);
            return null;
        }