public IList <GoalField> GetNotOccupiedGoalFields(TeamColour teamColour) { var possibleFields = Fields.Cast <Field>().Where(f => f is GoalField); var possibleGoalFields = possibleFields.Cast <GoalField>().Where(f => f.Team == teamColour && f.Type == GoalFieldType.goal); return(possibleGoalFields.ToList()); }
public Team(TeamColour color, uint maxPlayerCount) { Color = color; MaxPlayerCount = maxPlayerCount; Players = new List <Player>(); Leader = null; }
public GoalField(int x, int y, DateTime timeStamp, TeamColour team, GoalFieldType type, Player player = null) : base(x, y) { Type = type; Team = team; TimeStamp = timeStamp; Player = player; }
public TeamScoreDisplay(TeamColour teamColour) { this.teamColour = teamColour; RelativeSizeAxes = Axes.Y; Width = 300; }
public Player(Guid guid, ulong id, PlayerType type, TeamColour team) { this.Guid = guid; this.Id = id; this.PlayerType = type; this.TeamColour = team; }
public JoinGameMessage(string name, TeamColour team, PlayerRole role, long playerId = -1) { GameName = name; PrefferedTeam = team; PrefferedRole = role; PlayerId = playerId; }
public Field GetEmptyPositionForPlayer(TeamColour team) { //no player, TaskField or our GoalField var possibleFields = Fields.Cast <Field>().Where(f => (f is TaskField || (f is GoalField && !IsInEnemyGoalArea(f.Y, team))) && f.PlayerId == null); //maybe random is a bad idea (unfair?) return(possibleFields.RandomElementUsing(rnd)); }
public PlayerController(TeamColour team, PlayerRole role, PlayerSettingsConfiguration settings, string gameName = null) { clientSocket = new TcpClient(); PrefferedColor = team; PrefferedRole = role; Settings = settings; GameName = gameName; }
public DrawableTeamHeader(TeamColour colour) { Background.Colour = TournamentGame.GetTeamColour(colour); Text.Colour = TournamentGame.TEXT_COLOUR; Text.Text = $"Team {colour}".ToUpperInvariant(); Text.Scale = new Vector2(0.6f); }
private void EndGame(Wrapper.AddressableBoard board, TeamColour teamColour) { IList <Wrapper.GoalField> goalFields = board.GetNotOccupiedGoalFields(teamColour); if (goalFields.Count == 0) { endGame = true; } }
public bool IsInEnemyGoalArea(long y, TeamColour myTeam) { if (myTeam == TeamColour.blue) //we are blue, enemy is red and on top { return(y >= Height - GoalsHeight); } //we are red, enemy is blue and on the bottom return(y < GoalsHeight); }
private Player.Player PreparePlayerObject(TeamColour colour, ulong id, PlayerRole role = PlayerRole.member) { return new Player.Player(colour,role) { ID = id, GameId = 0, GUID = GetUniqueGUID() }; }
public Player.Player GetPlayer(string guid, ulong id, TeamColour tc, ActionType action) { var player = new Player.Player(tc, _guid: guid); player.ID = id; player.LastActionTaken = action; return(player); }
public GoalField(GoalField field) : base(field.ToBase()) { Type = field.Type; Team = field.Team; if (field.Player != null) { Player = new Player(field.Player); } }
public Player(Player original) { Team = original.Team; GUID = original.GUID; ID = original.ID; Location = new GameArea.GameObjects.Location(original.Location.X, original.Location.Y); if (original.piece != null) { this.piece = new GameArea.GameObjects.Piece(original.piece.ID, original.piece.TimeStamp, original.piece.Type, original.piece.PlayerId); // player can't see original piece (sham or goal info must be hidden) } }
private bool CheckIfNotEnteringWrongGoalArea(int x, int y, TeamColour team) { if (team == TeamColour.red && y < actualBoard.GoalAreaHeight || team == TeamColour.blue && y >= actualBoard.Height - actualBoard.GoalAreaHeight) { return(true); } else { return(false); } }
public Player.Player GetPlayer(string guid, ulong id, TeamColour tc, ActionType action) { var player = new Player.Player(tc, _guid: guid); player.ID = id; player.LastActionTaken = action; player.myTeam = new List <GameArea.GameObjects.Player>(); player.otherTeam = new List <GameArea.GameObjects.Player>(); return(player); }
private void setMode(TeamColour colour, ChoiceType choiceType) { pickColour = colour; pickType = choiceType; Color4 setColour(bool active) => active ? Color4.White : Color4.Gray; buttonRedBan.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Ban); buttonBlueBan.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Ban); buttonRedPick.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Pick); buttonBluePick.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Pick); }
public GoalDirectionInfo(List <GameArea.GameObjects.GoalField> goals, TeamColour team, GameArea.GameObjects.Location _PlayerLocation) { PlayerLocation = _PlayerLocation; Team = team; if (team == TeamColour.red) { Goals = goals.OrderBy(q => q.Y).ThenBy(q => q.X).Where(q => q.Type == GoalFieldType.unknown).ToList(); } else { Goals = goals.OrderByDescending(q => q.Y).ThenBy(q => q.X).Where(q => q.Type == GoalFieldType.unknown).ToList(); } }
public DrawableTeamWithPlayers(TournamentTeam team, TeamColour colour) { AutoSizeAxes = Axes.Both; InternalChildren = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(30), Children = new Drawable[] { new DrawableTeamTitleWithHeader(team, colour), new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Padding = new MarginPadding { Left = 10 }, Spacing = new Vector2(30), Children = new Drawable[] { new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, ChildrenEnumerable = team?.Players.Select(createPlayerText).Take(5) ?? Enumerable.Empty <Drawable>() }, new FillFlowContainer { Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, ChildrenEnumerable = team?.Players.Select(createPlayerText).Skip(5) ?? Enumerable.Empty <Drawable>() }, } }, } }, }; TournamentSpriteText createPlayerText(TournamentUser p) => new TournamentSpriteText { Text = p.Username, Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), Colour = Color4.White, }; }
public Player GetPlayer(string guid, ulong id, TeamColour tc, ActionType action, IPlayerController controller = null) { controller = new PlayerControllerMock(); var player = new Player(tc, _guid: guid); player.ID = id; player.LastActionTaken = action; player.Controller = controller; controller.Player = player; player.myTeam = new List <GameArea.GameObjects.Player>(); player.otherTeam = new List <GameArea.GameObjects.Player>(); return(player); }
/// <summary> /// Validates if an Player can move on a given field or disvover it /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="team"></param> /// <returns></returns> private bool ValidateFieldPosition(int x, int y, TeamColour team) { if (CheckIfNotOutOfBorad(x, y)) { return(false); } else if (CheckIfNotEnteringWrongGoalArea(x, y, team)) { return(false); } else { return(true); } }
/// <summary> /// FOR UNIT TESTING - set a piece of a given type in a given location /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="type"></param> /// <param name="id"></param> /// <returns></returns> public bool SetPieceInLocation(int x, int y, TeamColour team, PieceType type, ulong id) { var piece = new GameObjects.Piece(id, DateTime.Now, type); if (ValidateFieldPosition(x, y, team) && actualBoard.GetField(x, y) is GameObjects.TaskField) { (actualBoard.GetField(x, y) as GameObjects.TaskField).Piece = piece; UpdateDistancesFromAllPieces(); return(true); } else { return(false); } }
public Player(TeamColour team, PlayerRole role = PlayerRole.member, PlayerSettingsConfiguration settings = null, IPlayerController gameController = null, string _guid = "TEST_GUID", IGameMaster gm = null, ulong id = 0) { Settings = settings; gameMaster = gm; Team = team; GUID = _guid; Role = role; Location = new GameArea.GameObjects.Location(0, 0); Controller = gameController; State = AgentState.SearchingForGame; LastMoveTaken = MoveType.up; ID = id; MyPlayerKnowledgeExchangeQueue = new List <KnowledgeExchangeRequestAgent>(); OtherPlayerKnowledgeExchangeQueue = new List <KnowledgeExchangeRequestAgent>(); }
private void setNextMode() { const TeamColour roll_winner = TeamColour.Red; //todo: draw from match var nextColour = (currentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red; if (pickType == ChoiceType.Ban && currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2) { setMode(pickColour, ChoiceType.Pick); } else { setMode(nextColour, currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= 2 ? ChoiceType.Pick : ChoiceType.Ban); } }
public DrawableTeamTitleWithHeader(TournamentTeam team, TeamColour colour) { AutoSizeAxes = Axes.Both; InternalChild = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 10), Children = new Drawable[] { new DrawableTeamHeader(colour), new DrawableTeamTitle(team), } }; }
public List <GoalField> GoalFields(TeamColour team) { var goalFields = new List <GoalField>(); for (int i = 0; i < Height; i++) { for (int j = 0; j < Width; j++) { if (fields[j, i] is GoalField && ((GoalField)fields[j, i]).Team == team) { goalFields.Add((GoalField)fields[j, i]); } } } return(goalFields); }
public TeamScore(Bindable <int?> score, TeamColour colour, int count) { bool flip = colour == TeamColour.Blue; var anchor = flip ? Anchor.TopRight : Anchor.TopLeft; AutoSizeAxes = Axes.Both; InternalChild = counter = new TeamScoreStarCounter(count) { Anchor = anchor, Scale = flip ? new Vector2(-1, 1) : Vector2.One, }; currentTeamScore.BindValueChanged(scoreChanged); currentTeamScore.BindTo(score); }
public void GoToGoalArea(TeamColour color) { if (!InGoalArea) { switch (color) { case TeamColour.red: TryMove(MoveType.up, true); break; case TeamColour.blue: TryMove(MoveType.down, true); break; } } }
public ISoldierFactory GetTeam(TeamColour teamColour) { ISoldierFactory Team = null; switch (teamColour) { case TeamColour.Red: Team = new RedTeamFactory(); break; case TeamColour.Blue: Team = new BlueTeamFactory(); break; } return(Team); }
public void AddScore(TeamColour colour, int val) { switch (colour) { case TeamColour.RED: { _RedScore += val; _RedScoreText.text = _RedScore.ToString(); } break; case TeamColour.BLUE: { _BlueScore += val; _BlueScoreText.text = _BlueScore.ToString(); } break; case TeamColour.GREEN: { _GreenScore += val; _GreenScoreText.text = _GreenScoreText.ToString(); } break; case TeamColour.YELLOW: { _YellowScore += val; _YellowScoreText.text = _YellowScoreText.ToString(); } break; default: break; } }