// Initilisation d'un joueur public Player(Team team, Conf.PlayerPosition playerPosition, Conf.InteligenceType type) : base(Vector2.Zero,Conf.BAT_WIDTH,Conf.BAT_HEIGHT) { this.Team = team; this.CurrentSpeed = Conf.PLAYER_INIT_SPEED; HitBox = new Rectangle(); HitBox.Width = this.width; HitBox.Height = this.height; HitBox.X = (int)this.position.X; HitBox.Y = (int)this.position.Y; this.PlayerPosition = playerPosition; this.Type = type; this.setInital(); this.setHitBox(); this.IsAccelerating = false; }
//Initialisation du jeu suite au choix effectué dans le menu pour instancier les équipes et joueurs à créer public void initializeGame() { game.IsMouseVisible = false; Team teamLeft = null; Team teamRight = null; foreach (Button currentButton in leftChoices) { if (currentButton.state == Button.ButtonState.SELECTED) { teamLeft = new Team(Conf.TeamSide.LEFT, currentButton.nbPlayer, currentButton.intelligenceType, game); } } foreach (Button currentButton in rightChoices) { if (currentButton.state == Button.ButtonState.SELECTED) { teamRight = new Team(Conf.TeamSide.RIGHT, currentButton.nbPlayer, currentButton.intelligenceType, game); } } if (teamLeft == null || teamRight == null) { throw new UnauthorizedAccessException(); } game.LeftTeam = teamLeft; game.RightTeam = teamRight; }