private void OnTouch(Vector2 position) { if(IsValidTouchOnMe(position)) { string roomId = ravenhillGameModeService.currentRoom?.id ?? string.Empty; NpcInfo info = engine.GetService<INpcService>().GetNpc(npcId, roomId); if(info != null && (!info.IsEmpty)) { switch(info.Data.type) { case NpcType.enemy: { viewService.ShowView(RavenhillViewType.kill_enemy_view, info); } break; case NpcType.patient: { viewService.ShowView(RavenhillViewType.patient_reward_view, info); } break; } } } }
public bool Load(string saveStr) { if (saveStr.IsValid()) { Debug.Log($"LOAD NPC from {saveStr}"); UXMLDocument document = new UXMLDocument(); document.Parse(saveStr); npcs.Clear(); document.Element(saveId).Elements("npc").ForEach(npcElement => { NpcInfo info = new NpcInfo(); info.Load(npcElement); npcs[info.RoomId] = info; }); ValidateNpcDictionary(); isLoaded = true; } else { InitSave(); } return(isLoaded); }
public static void OnNpcCreated(string roomId, NpcInfo npc) { NpcCreated?.Invoke(roomId, npc); }