public NpcInfo DelayAddNpc(Data_Unit unit) { NpcInfo npc = NewNpcInfo(); npc.SceneContext = m_SceneContext; npc.LoadData(unit); m_DelayAdd.Add(npc); return(npc); }
public NpcInfo AddNpc(int id, Data_Unit unit) { NpcInfo npc = NewNpcInfo(id); npc.SceneContext = m_SceneContext; npc.LoadData(unit); npc.IsBorning = true; npc.SetAIEnable(false); npc.SetStateFlag(Operate_Type.OT_AddBit, CharacterState_Type.CST_Invincible); npc.BornTime = TimeUtility.GetServerMilliseconds(); m_Npcs.Add(npc.GetId(), npc); if (null != m_SceneContext && null != m_SceneContext.SpatialSystem) { m_SceneContext.SpatialSystem.AddObj(npc.SpaceObject); } if (null != m_SceneContext && null != m_SceneContext.SightManager) { m_SceneContext.SightManager.AddObject(npc); } return(npc); }