public IEnumerable <Character> IterateCharacters() { if (ActiveTeam != null) { foreach (Character player in ActiveTeam.EnumerateChars()) { yield return(player); } } foreach (Team team in AllyTeams) { foreach (Character character in team.EnumerateChars()) { yield return(character); } } foreach (Team team in MapTeams) { foreach (Character character in team.EnumerateChars()) { yield return(character); } } }
public void EnterMap(ExplorerTeam activeTeam, LocRay8 entryPoint) { ActiveTeam = activeTeam; //place characters around in order ActiveTeam.Leader.CharLoc = entryPoint.Loc; if (entryPoint.Dir != Dir8.None) { ActiveTeam.Leader.CharDir = entryPoint.Dir; } foreach (Character character in ActiveTeam.EnumerateChars()) { //TODO: there may be a problem here; the method for finding a free space searches through all characters already in the map //since the active team has already been added to the map, all characters are counted and can block themselves when reassigning locations //warp all active team allies next to the player of this floor Loc?endLoc = GetClosestTileForChar(character, entryPoint.Loc); if (endLoc == null) { endLoc = entryPoint.Loc; } character.CharLoc = endLoc.Value; if (entryPoint.Dir != Dir8.None) { character.CharDir = entryPoint.Dir; } if (!character.Dead) { UpdateExploration(character); } } }