示例#1
0
 public Register(Register copy)
     : base(copy)
 {
     if (copy != null)
     {
         Ships = new ShipList(copy.Ships);
         ShipsLeft = new ShipList(copy.ShipsLeft);
         Shots = new ShotList(copy.Shots);
         ShotsAgainst = new ShotList(copy.ShotsAgainst);
     }
 }
        /// <summary>
        /// Notifies the <see cref="Controller"/> that a match has begin, and updates the <see cref="ControllerRegister"/>
        /// to the one given by the <see cref="Match"/>. Provides a complete copy of the <see cref="ControllerRegister"/>
        /// to the <see cref="Controller"/>.
        /// </summary>
        /// <param name="registerInstance">The <see cref="ControllerRegister"/> for the <see cref="Controller"/>.</param>
        /// <exception cref="ControllerTimeoutException">Thrown if the controller exceeded the time limit specified
        /// in the <see cref="MatchInfo"/> located in the <see cref="ControllerRegister"/>.</exception>
        public void NewMatch(Register registerInstance)
        {
            Register = registerInstance;
            Register.Score = 0;
            controller.Register = new ControllerRegister(Register);

            var thread = new Thread(() =>
            controller.NewMatch());

            HandleThread(thread, "NewMatch");
        }