/// <summary>
        /// This method swaps the Piece properties of the 2 tiles passed.
        /// </summary>
        /// <param name="initialTile">The Tile to move from.</param>
        /// <param name="finalTile">The Tile to move to.</param>
        public void SwapTiles(Tile initialTile, Tile finalTile)
        {
            Chessman piece = finalTile.Piece;

            finalTile.Piece   = initialTile.Piece;
            initialTile.Piece = piece;
        }
        /// <summary>
        /// This method populates the board at the beginning of the level.
        /// </summary>
        public void PopulateBoard()
        {
            Chessman previous = null;

            foreach (Tile tile in this.board)
            {
                BoardManager.Instance.CreatePieceForTile(tile, previous);
                previous = tile.Piece;
            }
        }
Exemple #3
0
        /// <summary>
        /// This method clears the contents of the Tile object and notifies all observers of the change.
        /// </summary>
        public void Clear()
        {
            Notifier.NotifyObservers(Notification.Chessman_Deleted, this.Piece);

            if (this.Piece != null)
            {
                Destroy(this.Piece.gameObject);
            }

            this.Piece = null;
            Notifier.NotifyObservers(Notification.Tile_Is_Empty, this);
        }