コード例 #1
0
        public void MoveToTargetTile(BoardTile targetTile)
        {
            PossessingTile.Add(targetTile);

            inventory[(int)(targetTile.TileType)].Count++;

            transform.position = new Vector3(targetTile.transform.position.x, transform.position.y, targetTile.transform.position.z);

            int[] coordX = { 1, 0, -1, -1, 0, 1 };
            int[] coordZ = { 0, 1, 1, 0, -1, -1 };

            for (int i = 0; i < 6; i++)
            {
                BoardTile targetBoardTile;
                if (TileManager.Instance.BoardTileGrid[targetTile.TileCoordinate.x + coordX[i], targetTile.TileCoordinate.z + coordZ[i]] != null)
                {
                    targetBoardTile = TileManager.Instance.BoardTileGrid[targetTile.TileCoordinate.x + coordX[i], targetTile.TileCoordinate.z + coordZ[i]].GetComponent <BoardTile>();
                }
                else
                {
                    continue;
                }

                if (targetBoardTile.tileOwner == tileOwner)
                {
                    targetTile.TileBorder[i].SetActive(false);
                    targetBoardTile.TileBorder[(i + 3) % 6].SetActive(false);
                }
                else
                {
                    targetTile.TileBorder[i].SetActive(true);
                }
            }
        }
コード例 #2
0
ファイル: BoardAI.cs プロジェクト: DeaWonChoi/MyProject
        public void PossessTile(BoardTile boardTile)
        {
            PossessingTile.Add(boardTile);

            inventory[(int)(boardTile.TileType)].Count++;

            transform.position = new Vector3(boardTile.transform.position.x, transform.position.y, boardTile.transform.position.z);

            int[] coordX = { 1, 0, -1, -1, 0, 1 };
            int[] coordZ = { 0, 1, 1, 0, -1, -1 };

            for (int i = 0; i < 6; i++)
            {
                BoardTile targetBoardTile;
                if (TileManager.Instance.BoardTileGrid[boardTile.TileCoordinate.x + coordX[i], boardTile.TileCoordinate.z + coordZ[i]] != null)
                {
                    targetBoardTile = TileManager.Instance.BoardTileGrid[boardTile.TileCoordinate.x + coordX[i], boardTile.TileCoordinate.z + coordZ[i]].GetComponent <BoardTile>();
                }
                else
                {
                    continue;
                }

                if (targetBoardTile.tileOwner == tileOwner)
                {
                    boardTile.TileBorder[i].SetActive(false);
                    targetBoardTile.TileBorder[(i + 3) % 6].SetActive(false);
                }
                else
                {
                    boardTile.TileBorder[i].SetActive(true);
                }
            }
            MessageQueue.Enqueue(boardTile.TileType.ToString() + "타일을 점령중 입니다.");
            MessageQueue.Enqueue(boardTile.TileType.ToString() + "타일을 점령했습니다");
        }
コード例 #3
0
 public void PossessTile(BoardTile targetTile)
 {
     PossessingTile.Add(targetTile);
 }