Provides the modifications, events, and properties that are necessary to operate a game of battleship. All events must be subscribed to.
상속: System.Entity
예제 #1
0
 /// <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;
 }
예제 #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;
 }
예제 #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);
        }
예제 #4
0
 /// <summary>
 /// Constructs the event.
 /// </summary>
 public MatchEndEvent(Match match)
     : base(match)
 {
 }
예제 #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;
 }
예제 #7
0
 /// <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;
 }
예제 #9
0
 /// <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;
 }