/// <summary>
        /// NPC出生
        /// </summary>
        public void NpcSpawn(NPCData npcData, Action <object> callback)
        {
            var spawnEvent = new NpcSpawnEvent();

            spawnEvent.isShowHUD = LogicConst.BattleType == BattleType.TurnBase;
            spawnEvent.npcData   = npcData;
            spawnEvent.callback  = callback;

            var evData = new GameEventData(GameEventType.NpcSpawn, spawnEvent);

            evMappingMgr.Add(evData);
            Messenger.Broadcast <GameEventData>(EventNames.EvNpcSpawn, evData);
        }
        private OTAPI.HookResult SpawnHandler(ref int npcIndex)
        {
            Debug.Assert(npcIndex >= 0 && npcIndex < Count);

            var npc = this[npcIndex];
            var evt = new NpcSpawnEvent(npc);

            _events.Raise(evt, _log);
            if (evt.IsCanceled)
            {
                // To cancel the event, remove the NPC and return the failure index.
                npc.IsActive = false;
                npcIndex     = Count;
                return(OTAPI.HookResult.Cancel);
            }

            return(OTAPI.HookResult.Continue);
        }