public List <Fighter> GetAllFighters(bool aliveOnly = true) { List <Fighter> fighters = new List <Fighter>(); fighters.AddRange(RedTeam.GetFighters(aliveOnly)); fighters.AddRange(BlueTeam.GetFighters(aliveOnly)); return(fighters); }
public List<Fighter> GetAllFighters(bool deaths = false) { List<Fighter> result = new List<Fighter>(); if (BlueTeam != null && RedTeam != null) { result.AddRange(BlueTeam.GetFighters(deaths)); result.AddRange(RedTeam.GetFighters(deaths)); } return result; }
public short GetPlacementCell(TeamColorEnum team) { List<short> usedplacement; switch (team) { case TeamColorEnum.BLUE_TEAM: usedplacement = BlueTeam.GetFighters().ConvertAll<short>(x => x.CellId); return Map.BlueCells.Find(x => !usedplacement.Contains(x)); case TeamColorEnum.RED_TEAM: usedplacement = RedTeam.GetFighters().ConvertAll<short>(x => x.CellId); return Map.RedCells.Find(x => !usedplacement.Contains(x)); } return 0; }
public bool CheckFightEnd() { if (Ended) return true; if (BlueTeam.GetFighters().Alives().Count == 0 || RedTeam.GetFighters().Alives().Count == 0) { if (Started) Synchronizer.Start(EndFight); else EndFight(); Ended = true; return true; } return false; }
public bool IsPlacementCellFree(TeamColorEnum team) { List<short> usedplacement; switch (team) { case TeamColorEnum.BLUE_TEAM: { usedplacement = BlueTeam.GetFighters().ConvertAll<short>(x => x.CellId); return Map.BlueCells.FindAll(x => !usedplacement.Contains(x)).Count != 0; } case TeamColorEnum.RED_TEAM: usedplacement = RedTeam.GetFighters().ConvertAll<short>(x => x.CellId); return Map.RedCells.FindAll(x => !usedplacement.Contains(x)).Count != 0; } return false; }
public TeamColorEnum GetWinner() { List<CharacterFighter> bluePlayers = BlueTeam.GetCharacterFighters(true); if (bluePlayers.Count > 0 && bluePlayers.All(x => x.HasLeft)) return TeamColorEnum.RED_TEAM; List<CharacterFighter> redPlayers = RedTeam.GetCharacterFighters(true); if (redPlayers.Count > 0 && redPlayers.All(x => x.HasLeft)) return TeamColorEnum.BLUE_TEAM; if (BlueTeam.GetFighters().Alives().Count == 0) { return TeamColorEnum.RED_TEAM; } else if (RedTeam.GetFighters().Alives().Count == 0) { return TeamColorEnum.BLUE_TEAM; } Logger.Error("Try to define winner but fight is running..."); return 0; }