Provides the modifications, events, and properties that are necessary to operate a game of battleship. All events must be subscribed to.
Inheritance: System.Entity
 /// <summary>
 /// Constructs this event
 /// </summary>
 public MatchBeginEvent(Match copyParams)
     : base(copyParams)
 {
     CurrentRound = copyParams.CurrentRound;
     FieldSize = copyParams.FieldSize;
     NumberOfRounds = copyParams.NumberOfRounds;
     Random = copyParams.Random;
     RoundMode = copyParams.RoundMode;
     StartingShips = copyParams.StartingShips;
     TimeLimit = copyParams.TimeLimit;
     TurnOrder = copyParams.TurnOrder;
 }
Example #2
0
 public MatchConfig(Match matchCopy)
 {
     if (matchCopy.StartingShips != null)
     {
         StartingShips = new ShipList(matchCopy.StartingShips.ToList());
     }
     NumberOfRounds = matchCopy.NumberOfRounds;
     FieldSize = matchCopy.FieldSize;
     TimeLimit = matchCopy.TimeLimit;
     GameMode = GameMode.Classic;
     Random = matchCopy.Random;
 }
Example #3
0
        public void NewMatch()
        {
            this.player = this.controller.Player;
            this.match = this.player.Match;
            ShotHelper.MatchX = match.FieldSize.X - 1;
            ShotHelper.MatchY = match.FieldSize.Y - 1;

            this.shipLengths = this.match.StartingShips.Select(ship => ship.Length).ToArray();

            cellStateMap = new CellStateMap(match.FieldSize.X);

            historyMap = new HistoryMap(match.FieldSize.X, this.shipLengths, cellStateMap);
            placementMap = new PlacementMap(match.FieldSize.X, this.shipLengths, cellStateMap);
            huntingMap = new HuntingMap(match.FieldSize.X, this.shipLengths, cellStateMap);
        }
 /// <summary>
 /// Constructs the event.
 /// </summary>
 public MatchEndEvent(Match match)
     : base(match)
 {
 }
Example #5
0
 protected MatchEvent(Match match)
     : base(match)
 {
     Match = match;
 }
 /// <summary>
 /// Constructs this event with the given player.
 /// </summary>
 /// <param name="player"></param>
 public MatchAddPlayerEvent(Match match, Player player)
     : base(match)
 {
     Player = player;
 }
 /// <summary>
 /// Passes the <paramref name="round"/> to the base constructor
 /// </summary>
 /// <param name="round"></param>
 public RoundEndEvent(Match match, IDNumber roundNumber)
     : base(match)
 {
     Round = roundNumber;
 }
 /// <summary>
 /// Constructs this event with the player being removed.
 /// </summary>
 /// <param name="player"></param>
 public MatchRemovePlayerEvent(Match match, Player player)
     : base(match)
 {
     Player = player;
 }
 /// <summary>
 /// Constructs the event with the new team.
 /// </summary>
 /// <param name="team"></param>
 public MatchTeamAddEvent(Match match, Team team)
     : base(match)
 {
     Team = team;
 }
 /// <summary>
 /// Constructs the event with the team to be removed.
 /// </summary>
 /// <param name="team"></param>
 public MatchTeamRemoveEvent(Match match, Team team)
     : base(match)
 {
     Team = team;
 }