예제 #1
0
 private void setGrid()
 {
     if (this.grid == null)
     {
         this.grid = gameManager.GetComponent <Board.Grid>();
     }
 }
예제 #2
0
        void settings(Vector2 start, Vector2 end)
        {
            setPlayer();
            if (player.status.mov > 0 && player.status.pontosAcao > 0)
            {
                int moveX = Convert.ToInt32(start.x - end.x);
                if (moveX < 0)
                {
                    moveX = -moveX;
                }
                int moveY = Convert.ToInt32(start.y - end.y);
                if (moveY < 0)
                {
                    moveY = -moveY;
                }
                int move           = moveX + moveY;
                int pontosAcaoMove = move * 2;
                if (move > player.status.mov || pontosAcaoMove > player.status.pontosAcao)
                {
                    return;
                }

                this.player.status.mov        -= move;
                this.player.status.pontosAcao -= pontosAcaoMove;
                Board.Grid grid = gameManager.GetComponent <Board.Grid>();
                grid.ChangeCharacterPosition(start, end);
                this.playerPos.Add(start);
                this.endPos.Add(end);
                this.qtyMove++;
            }
        }