void NewGame() { var assets = Resolve <IAssetManager>(); PartyMembers.Clear(); foreach (PartyCharacterId charId in Enum.GetValues(typeof(PartyCharacterId))) { PartyMembers.Add(charId, assets.LoadCharacter(AssetType.PartyMember, charId)); } Npcs.Clear(); foreach (NpcCharacterId charId in Enum.GetValues(typeof(NpcCharacterId))) { Npcs.Add(charId, assets.LoadCharacter(AssetType.Npc, charId)); } Chests.Clear(); foreach (ChestId id in Enum.GetValues(typeof(ChestId))) { Chests.Add(id, assets.LoadChest(id)); } Merchants.Clear(); foreach (MerchantId id in Enum.GetValues(typeof(MerchantId))) { Merchants.Add(id, assets.LoadMerchant(id)); } _party.Clear(); Raise(new AddPartyMemberEvent(PartyCharacterId.Tom)); Raise(new AddPartyMemberEvent(PartyCharacterId.Rainer)); Raise(new AddPartyMemberEvent(PartyCharacterId.Drirr)); Raise(new AddPartyMemberEvent(PartyCharacterId.Sira)); Raise(new AddPartyMemberEvent(PartyCharacterId.Mellthas)); Raise(new AddPartyMemberEvent(PartyCharacterId.Khunag)); SetupTestState(); Raise(new ReloadAssetsEvent()); // No need to keep character info cached once we've loaded it. New game is also a good point to clear out state. Raise(new PartyChangedEvent()); Raise(new LoadMapEvent(MapDataId.Toronto2DGesamtkarteSpielbeginn)); Raise(new StartClockEvent()); Loaded = true; }
private void HandlePartyMemberRemoveMessage(IAccount account, PartyMemberRemoveMessage message) { if (PartyMembers.ContainsKey(message.LeavingPlayerId)) { Logger.Default.Log($"Player <{PartyMembers[message.LeavingPlayerId].Name}> was removed from your party.", LogMessageType.Party); PartyMembers.Remove(message.LeavingPlayerId); if (PartyMembers.Count == 1) { Logger.Default.Log($"Your party has been disbanded.", LogMessageType.Party); PartyMembers.Clear(); } else { Logger.Default.Log($"Your party has now {PartyMembers.Count} members", LogMessageType.Party); } } else { Logger.Default.Log($"Player <{message.LeavingPlayerId}> is not a member of your party. It can't be removed.", LogMessageType.Party); } }
public AllyMember FindPartyMembers() { PartyMembers.Clear(); AllyMember[] Allies = GameObject.FindObjectsOfType <AllyMember>(); foreach (var ally in Allies) { if (ally.GeneralCommander == this.GeneralCommander) { PartyMembers.Add(ally); } } if (PartyMembers.Count <= 0) { Debug.LogWarning("No partyMembers in Scene!"); return(null); } else { AllyMember firstallyfound = PartyMembers[0]; return(firstallyfound); } }