Beispiel #1
0
 void Awake()
 {
     myBoard     = gameObject.GetComponentInChildren <Board>();
     board       = myBoard.board;
     Move        = myBoard.Move;
     ActiveBoard = myBoard;
     myBoard.BuildBoard(myBoard);
     //BattleBoard = gameObject.AddComponent<Board>();
     Move.board = board;
     //BattleBoardSO.BoardSize = myBoard.SubSize;
     //BattleBoard.ZoomedInBoard = true;
 }
Beispiel #2
0
    public void SetVariables(BoardSO newboard)
    {
        board            = newboard;
        Move             = gameObject.GetComponentInChildren <Movement>();
        Move.ActiveBoard = this;

        /*Tiles = new Tile[newboard.BoardSize, newboard.BoardSize];
         * Pieces = new Piece[newboard.BoardSize, newboard.BoardSize];
         * TilePos = new float[newboard.BoardSize, newboard.BoardSize, 2, 2];
         * TileCoord = new float[1, 1, 2];*/
        Wd = newboard.BoardSize;
    }
Beispiel #3
0
    public static void Create(int worldSize, Board MyBoard)
    {
        BoardSO board   = MyBoard.board;
        int     subSize = MyBoard.SubSize;

        for (int x = 0; x < worldSize; x++)
        {
            for (int y = 0; y < worldSize; y++)
            {
                //Tile tile = TileDataAsset.CreateTileAsset();
                Tile tile = ScriptableObject.CreateInstance <Tile>();
                MyBoard.board.Tiles[x, y] = tile;
                tile.name = "Tile " + x + ", " + y;

                if (MyBoard.ZoomedInBoard == false)
                {
                    if (x == 3 && y == x)
                    {
                        Spawn.SpawnStructure(x, y, 0, "City", MyBoard);
                    }
                }

                /*tile.SubTiles = new Tile[subSize, subSize];
                 * tile.subPos = new float[subSize, subSize, 2, 2];*/
                tile.Xcoord = x;
                tile.Ycoord = y;
                float alt = NoiseFunction(x, y, 0.9f);
                tile.Altitude = alt;
                //LayoutStructures(tile, MyBoard, false);

                /*for (int Sx = 0; Sx < subSize; Sx++)
                 * {
                 *  for (int Sy = 0; Sy < subSize; Sy++)
                 *  {
                 *      Tile tempsub = ScriptableObject.CreateInstance<Tile>();
                 *      tile.SubTiles[Sx, Sy] = tempsub;
                 *      tempsub.name = tile.name + ", square " + Sx + ", " + Sy;
                 *      tempsub.Parent = tile;
                 *      tempsub.SubX = Sx;
                 *      tempsub.Xcoord = x;
                 *      tempsub.SubY = Sy;
                 *      tempsub.Ycoord = y;
                 *      tempsub.SubAltitude = Mathf.PerlinNoise(Sx * tile.Xcoord * 0.9f, Sy * tile.Ycoord * 0.9f);
                 *      tile.SubAltitude = tempsub.SubAltitude;
                 *      LayoutStructures(tempsub, MyBoard, true);
                 *  }
                 * }*/
            }
        }
    }
Beispiel #4
0
    private void MovePiece(int[] VictimCoord, Tile Victim, Tile Attacker)
    {
        BoardSO myboard = ActiveBoard.board;

        Attacker.Occupied.PieceObj.transform.position = Victim.TileObj.transform.position;
        int[] AttackerCoord = TileOps.GetCoordFromVector(Attacker.TileObj.transform.position, ActiveBoard);
        if (Victim.Occupied != null)
        {
            Destroy(Victim.Occupied.PieceObj);
        }
        Victim.Occupied = Attacker.Occupied;
        myboard.Pieces[VictimCoord[0], VictimCoord[1]]     = Attacker.Occupied;
        myboard.Pieces[AttackerCoord[0], AttackerCoord[1]] = null;
        Attacker.Occupied = null;

        int Facing = myboard.Pieces[VictimCoord[0], VictimCoord[1]].Facing;

        int X1 = AttackerCoord[0];
        int Y1 = AttackerCoord[1];
        int X2 = VictimCoord[0];
        int Y2 = VictimCoord[1];

        if (Y2 > Y1 && X2 == X1)
        {
            Facing = 0;                      // Moved North
        }
        if (Y2 < Y1 && X2 == X1)
        {
            Facing = 4;                      // Moved South
        }
        if (Y2 == Y1 && X2 > X1)
        {
            Facing = 2;                      // Moved East
        }
        if (Y2 == Y1 && X2 < X1)
        {
            Facing = 6;                      // Moved West
        }
        if (Y2 > Y1 && X2 > X1)
        {
            Facing = 1;                     // Moved North East
        }
        if (Y2 > Y1 && X2 < X1)
        {
            Facing = 7;                     // Moved North West
        }
        if (Y2 < Y1 && X2 > X1)
        {
            Facing = 3;                     // Moved South East
        }
        if (Y2 < Y1 && X2 < X1)
        {
            Facing = 5;                     // Moved South West
        }
        myboard.Pieces[VictimCoord[0], VictimCoord[1]].Facing = Facing;
        Destroy(Victim.Occupied.PieceObj);

        GameObject[] PieceToSpawn = new GameObject[8];
        if (Victim.Occupied.PieceType == "Pawn")
        {
            PieceToSpawn = board.Pawn;
        }
        if (Victim.Occupied.PieceType == "Queen")
        {
            PieceToSpawn = board.Queen;
        }
        if (Victim.Occupied.PieceType == "Bishop")
        {
            PieceToSpawn = board.Bishop;
        }
        if (Victim.Occupied.PieceType == "Rook")
        {
            PieceToSpawn = board.Rook;
        }
        if (Victim.Occupied.PieceType == "King")
        {
            PieceToSpawn = board.King;
        }
        if (Victim.Occupied.PieceType == "Knight")
        {
            PieceToSpawn = board.Knight;
        }

        GameObject tempPiece = Instantiate(PieceToSpawn[Build.SetDirection(board.currentView, Victim.Occupied.Facing)], Victim.TileObj.transform.position, Quaternion.identity);

        Victim.Occupied.PieceObj = tempPiece;
        Build.SetPieceColor(tempPiece, Victim.Occupied.PlayerColor, ActiveBoard);
        ClearSelection();
        return;
    }
Beispiel #5
0
    public void FindPossibleMoves(int X, int Y)
    {
        BoardSO thisBoard = ActiveBoard.board;
        Tile    Attacker  = thisBoard.Tiles[X, Y];
        Tile    Victim;

        SelectionTracker(X, Y, Attacker.TileObj.transform.position, 1);
        if (Attacker.Occupied != null)
        {
            string pieceType = Attacker.Occupied.PieceType;

            if (pieceType == "Pawn")
            {
                // Moving

                List <int[]> Moves = NorthTile(X, Y, 1);

                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X, Y + 1];
                    if (Victim.Occupied == null)     // Move Only if empty
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, 2);
                    }
                }

                Moves = EastTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X + 1, Y];
                    if (Victim.Occupied == null)     // Move Only if empty
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, 2);
                    }
                }

                Moves = WestTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X - 1, Y];
                    if (Victim.Occupied == null)     // Move Only if empty
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, 2);
                    }
                }

                Moves = SouthTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X, Y - 1];
                    if (Victim.Occupied == null)     // Move Only if empty
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, 2);
                    }
                }


                // Attacking


                Moves = NorthEastTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X + 1, Y + 1];
                    if (Victim.Occupied != null && Victim.Occupied.PlayerColor != Attacker.Occupied.PlayerColor)     // attack if enemy
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = NorthWestTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X - 1, Y + 1];
                    if (Victim.Occupied != null && Victim.Occupied.PlayerColor != Attacker.Occupied.PlayerColor)     // attack if enemy
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = SouthEastTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X + 1, Y - 1];
                    if (Victim.Occupied != null && Victim.Occupied.PlayerColor != Attacker.Occupied.PlayerColor)     // attack if enemy
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = SouthWestTile(X, Y, 1);
                foreach (int[] moves in Moves)
                {
                    Victim = thisBoard.Tiles[X - 1, Y - 1];
                    if (Victim.Occupied != null && Victim.Occupied.PlayerColor != Attacker.Occupied.PlayerColor)     // attack if enemy
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }
            }

            if (pieceType == "Queen")
            {
                int          localRange = 7;
                List <int[]> Moves      = NorthTile(X, Y, localRange);

                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = EastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = WestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = SouthTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = NorthEastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                }

                Moves = NorthWestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = SouthEastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = SouthWestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }
            }

            if (pieceType == "Bishop")
            {
                int          localRange = 7;
                List <int[]> Moves      = NorthEastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                }

                Moves = NorthWestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = SouthEastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }

                Moves = SouthWestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2] /* it should be "3" or attackTracker*/);
                    }
                }
            }

            if (pieceType == "Rook")
            {
                int          localRange = 7;
                List <int[]> Moves      = NorthTile(X, Y, localRange);

                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = EastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = WestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = SouthTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }
            }

            if (pieceType == "King")
            {
                int          localRange = 1;
                List <int[]> Moves      = NorthTile(X, Y, localRange);

                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = EastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = WestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = SouthTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = NorthEastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = NorthWestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                    }
                }

                Moves = SouthEastTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                    }
                }

                Moves = SouthWestTile(X, Y, localRange);
                foreach (int[] moves in Moves)
                {
                    {
                        SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                    }
                }
            }

            if (pieceType == "Knight")
            {
                List <int[]> Moves = KnightUpLeft(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }
                Moves = KnightUpRight(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = KnightDownRight(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }
                Moves = KnightDownLeft(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = KnightLeftUp(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }
                Moves = KnightLeftDown(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }

                Moves = KnightRightUp(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }
                Moves = KnightRightDown(X, Y);
                foreach (int[] moves in Moves)
                {
                    SelectionTracker(moves[0], moves[1], thisBoard.Tiles[moves[0], moves[1]].TileObj.transform.position, moves[2]);
                }
            }
        }
    }
Beispiel #6
0
    /*public static void buildSubTiles(int SQsize, int view, Board MyBoard, Tile tile)
     * {
     *  BoardSO board = MyBoard.board;
     *  Movement Move = MyBoard.Move;
     *  {
     *      for (int x = 0; x < SQsize; x++)
     *      {
     *          for (int y = 0; y < SQsize; y++)
     *          {
     *              Tile TempSquare = tile.SubTiles[x, y];
     *              Vector3 pos = BuildSecond(x, y, board.BoardSize, view, MyBoard);
     *
     *              pos.y += TempSquare.SubAltitude/3;
     *              GameObject tileObj = Instantiate(board.DefaultGrassTiles[view], pos, Quaternion.identity); // Create new
     *              tileObj.name = "tileObj " + x + ", " + y;
     *
     *              if (TempSquare.TileObj != null) Destroy(TempSquare.TileObj); // Destroy Previous
     *              TempSquare.TileObj = tileObj;
     *              //Debug.Log("TempTile " + TempTile.name + ", tileObj " + x + ", " + y);
     *              tile.SubTiles[x, y] = TempSquare;
     *              int View = board.currentView;
     *
     *              float[,,,] TilePos = tile.subPos;
     *
     *              TilePos[x, 0, 0, 0] = x;
     *              TilePos[x, y, 0, 0] = y;
     *              TilePos[x, y, 1, 0] = pos.x;
     *              TilePos[x, y, 0, 1] = pos.y;
     *              TilePos[x, y, 1, 1] = pos.z;
     *
     *              if (TempSquare.Occupied != null)
     *              {
     *                  Piece tempPiece = TempSquare.Occupied;
     *                  GameObject[] PieceToSpawn = new GameObject[8];
     *
     *                  if (tempPiece.PieceType == "Pawn") { PieceToSpawn = board.Pawn; }
     *                  if (tempPiece.PieceType == "Queen") { PieceToSpawn = board.Queen; }
     *                  if (tempPiece.PieceType == "Bishop") { PieceToSpawn = board.Bishop; }
     *                  if (tempPiece.PieceType == "Rook") { PieceToSpawn = board.Rook; }
     *                  if (tempPiece.PieceType == "King") { PieceToSpawn = board.King; }
     *                  if (tempPiece.PieceType == "Knight") { PieceToSpawn = board.Knight; }
     *
     *                  GameObject pieceToSpawn = PieceToSpawn[SetDirection(board.currentView, tempPiece.Facing)];
     *                  GameObject tempPieceObj = Instantiate(pieceToSpawn, pos, Quaternion.identity);
     *
     *                  SetPieceColor(tempPieceObj, tempPiece.PlayerColor, MyBoard);
     *
     *                  if (tempPiece != null) Destroy(tempPiece.PieceObj);
     *                  tempPiece.PieceObj = tempPieceObj;
     *              }
     *
     *              if (TempSquare.TrackerType != 0)
     *              {
     *                  int trackerType = TempSquare.TrackerType;
     *                  GameObject tracker = null;
     *
     *                  if (trackerType == 1) tracker = board.SelectionTracker[View % 2];
     *                  if (trackerType == 2) tracker = board.MoveTracker[View % 2];
     *                  if (trackerType == 3) tracker = board.AttackTracker[View % 2];
     *
     *                  if (TempSquare.SelectionTracker != null) Destroy(TempSquare.SelectionTracker);
     *                  GameObject tempTracker = Instantiate(tracker, pos, Quaternion.identity);
     *                  TempSquare.SelectionTracker = tempTracker;
     *                  tempTracker.name = "SelectionTracker " + x + ", " + y;
     *                  Move.SelectedObject = TempSquare.TileObj;
     *              }
     *
     *              if (TempSquare.Structure != null)
     *              {
     *                  Structure Structure = TempSquare.Structure;
     *                  string StructureType = Structure.StructType;
     *                  GameObject structure = null;
     *                  if (StructureType == "City") structure = board.City[View % 2];
     *                  if (StructureType == "Forest") structure = board.Forest[View % 2];
     *                  if (StructureType == "Field") structure = board.Field[View % 2];
     *                  if (TempSquare.StructureObj != null) Destroy(TempSquare.StructureObj);
     *                  GameObject tempStructure = Instantiate(structure, pos, Quaternion.identity);
     *                  TempSquare.StructureObj = tempStructure;
     *                  tempStructure.name = StructureType + " " + x + ", " + y;
     *              }
     *          }
     *      }
     *  }
     * }*/

    public static void build(int worldsize, int view, Board MyBoard)
    {
        BoardSO  board = MyBoard.board;
        Movement Move  = MyBoard.Move;

        if (Move.SelectedObject != null)
        {
            Move.ClearSelection();
        }
        //if (MyBoard.battle == true) { buildSquares(worldsize, view, MyBoard); }
        for (int x = 0; x < worldsize; x++)
        {
            for (int y = 0; y < worldsize; y++)
            {
                Tile    TempTile = board.Tiles[x, y];
                Vector3 pos      = BuildSecond(x, y, board.BoardSize, view, MyBoard);
                //TempTile.Altitude = Mathf.PerlinNoise(x / 3.2f, y / 3.2f);


                pos.y += TempTile.Altitude;                                                                //TempTile.Altitude/2;

                GameObject tileObj = Instantiate(board.DefaultGrassTiles[view], pos, Quaternion.identity); // Create new
                tileObj.name = "tileObj " + x + ", " + y;

                if (TempTile.TileObj != null)
                {
                    Destroy(TempTile.TileObj);                           // Destroy Previous
                }
                TempTile.TileObj = tileObj;
                //Debug.Log("TempTile " + TempTile.name + ", tileObj " + x + ", " + y);
                board.Tiles[x, y] = TempTile;
                int View = board.currentView;

                float[,,,] TilePos = MyBoard.board.TilePos;

                TilePos[x, 0, 0, 0] = x;
                TilePos[x, y, 0, 0] = y;
                TilePos[x, y, 1, 0] = pos.x;
                TilePos[x, y, 0, 1] = pos.y;
                TilePos[x, y, 1, 1] = pos.z;



                if (TempTile.Occupied != null)
                {
                    Piece        tempPiece    = TempTile.Occupied;
                    GameObject[] PieceToSpawn = new GameObject[8];

                    if (tempPiece.PieceType == "Pawn")
                    {
                        PieceToSpawn = board.Pawn;
                    }
                    if (tempPiece.PieceType == "Queen")
                    {
                        PieceToSpawn = board.Queen;
                    }
                    if (tempPiece.PieceType == "Bishop")
                    {
                        PieceToSpawn = board.Bishop;
                    }
                    if (tempPiece.PieceType == "Rook")
                    {
                        PieceToSpawn = board.Rook;
                    }
                    if (tempPiece.PieceType == "King")
                    {
                        PieceToSpawn = board.King;
                    }
                    if (tempPiece.PieceType == "Knight")
                    {
                        PieceToSpawn = board.Knight;
                    }

                    GameObject pieceToSpawn = PieceToSpawn[SetDirection(board.currentView, tempPiece.Facing)];
                    GameObject tempPieceObj = Instantiate(pieceToSpawn, pos, Quaternion.identity);

                    SetPieceColor(tempPieceObj, tempPiece.PlayerColor, MyBoard);

                    if (tempPiece != null)
                    {
                        Destroy(tempPiece.PieceObj);
                    }
                    tempPiece.PieceObj = tempPieceObj;

                    //Debug.Log(TempTile.Occupied.PieceObj.transform.position);
                }

                if (TempTile.TrackerType != 0)
                {
                    int        trackerType = TempTile.TrackerType;
                    GameObject tracker     = null;


                    if (trackerType == 1)
                    {
                        tracker = board.SelectionTracker[View % 2];
                    }
                    if (trackerType == 2)
                    {
                        tracker = board.MoveTracker[View % 2];
                    }
                    if (trackerType == 3)
                    {
                        tracker = board.AttackTracker[View % 2];
                    }

                    if (TempTile.SelectionTracker != null)
                    {
                        Destroy(TempTile.SelectionTracker);
                    }
                    GameObject tempTracker = Instantiate(tracker, pos, Quaternion.identity);
                    TempTile.SelectionTracker = tempTracker;
                    tempTracker.name          = "SelectionTracker " + x + ", " + y;
                    Move.SelectedObject       = TempTile.TileObj;
                }

                if (TempTile.Structure != null)
                {
                    Structure  Structure     = TempTile.Structure;
                    string     StructureType = Structure.StructType;
                    GameObject structure     = null;
                    if (StructureType == "City")
                    {
                        structure = board.City[View % 2];
                    }
                    if (StructureType == "Forest")
                    {
                        structure = board.Forest[View % 2];
                    }
                    if (StructureType == "Field")
                    {
                        structure = board.Field[View % 2];
                    }
                    if (StructureType == "Mountain")
                    {
                        structure = board.Mountains[View % 2];
                    }
                    if (StructureType == "Rocks")
                    {
                        structure = board.Rocks[View % 2];
                    }
                    if (TempTile.StructureObj != null)
                    {
                        Destroy(TempTile.StructureObj);
                    }
                    GameObject tempStructure = Instantiate(structure, pos, Quaternion.identity);
                    TempTile.StructureObj = tempStructure;
                    tempStructure.name    = StructureType + " " + x + ", " + y;
                }
            }
        }
    }