Esempio n. 1
0
 private void MoveToStart(GameObject tile)
 {
     Piece = GameManager.instance.CurrentPiece;
     Piece.transform.position = tile.transform.position;
     Piece.SetCurrentTile(tile);
     tile.GetComponent <Tile>().HighlightTile(false);
 }
Esempio n. 2
0
    [SerializeField] private CharacterPiece Piece; // Piece to move

    /// <summary>
    /// Nav Mesh is used to find a path to the selcted tile by using the agent var from
    /// the character piece.
    /// </summary>
    /// <param name="tile">Destination tile selected</param>
    public void MovePiece(GameObject tile)
    {
        if (GameManager.instance.TurnStarted) // only do if turn has started
        {
            // if button is not blocked by player
            if (EventSystem.current.IsPointerOverGameObject())
            {
                Piece = GameManager.instance.Turn.Piece;
                GameManager.instance.Turn.Moving();
                //TODO: Animate**********
                GameManager.instance.CurrentPiece = Piece;
                Piece.Agent.SetDestination(tile.transform.position);
                Piece.SetCurrentTile(tile);
                Piece.StartCoroutine(WaitForAgent());
            }
        }
        else
        {
            // use this for the start of the game to move the each piece to starting location
            MoveToStart(tile);
        }
    }