/// <summary> /// Generates the NPC and place it at the location the spawner is on the map. /// </summary> public virtual GroundChar Spawn(GroundMap currentmap) { if (!EntEnabled) { return(null); } CurrentNPC = new GroundChar(NPCChar, Position, Direction, NPCName); //Setup callbacks on the spawned entity foreach (LuaEngine.EEntLuaEventTypes t in EntityCallbacks) { CurrentNPC.AddScriptEvent(t); } currentmap.AddTempChar(CurrentNPC); CurrentNPC.OnMapInit(); //Run our script callback after we spawned CoroutineManager.Instance.StartCoroutine(RunEvent(LuaEngine.EEntLuaEventTypes.EntSpawned, CurrentNPC)); return(CurrentNPC); }
/// <summary> /// This is called when the map owning the entity is deserialized. /// Its meant to help entities re-subscribe their events to the proper delegates, /// and load their assigned lua function. /// </summary> public virtual void OnDeserializeMap(GroundMap map) { //does nothing by default }
public override void OnSerializeMap(GroundMap map) { //DiagManager.Instance.LogInfo(String.Format("GroundChar.OnDeserializeMap(): Handling {0}..", EntName)); SavePosition(); }