public Task <IEntity> GetTarget(int id) { return(m_fiber.Enqueue(() => { PlayerPeer player = default(PlayerPeer); NPCInstance npc = default(NPCInstance); IEntity target = default(IEntity); if (m_playersInZone.TryGetValue(id, out player)) { target = (IEntity)player; } else if (m_npcs.TryGetValue(id, out npc)) { target = (IEntity)npc; } return target; }, false)); }
public Zone(int zoneID, INPCRepository npcRepository, NPCFactory npcFactory, MapData mapData) { ID = zoneID; m_npcRepository = npcRepository; m_npcFactory = npcFactory; m_mapData = mapData; m_npcSpawns = LoadZoneNPCSpawns(); m_npcArray = new NPCInstance[m_npcSpawns.Count]; for (int i = 0; i < m_npcSpawns.Count; i++) { NPCInstance npcInstance = npcFactory.CreateNPC(m_fiber, m_npcSpawns[i], mapData); m_npcs.Add(npcInstance.ID, npcInstance); m_npcArray[i] = npcInstance; } m_playerArray = Enumerable.Empty <PlayerPeer>().ToArray(); m_fiber.Enqueue(Update); }
public void Update(TimeSpan dt, NPCInstance npc) { }