Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
 /// <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
 }
Esempio n. 3
0
 public override void OnSerializeMap(GroundMap map)
 {
     //DiagManager.Instance.LogInfo(String.Format("GroundChar.OnDeserializeMap(): Handling {0}..", EntName));
     SavePosition();
 }