Пример #1
0
 /// <summary>
 /// Generates an attempted move/place if the tile is clicked.
 /// </summary>
 public override void OnClick(GamepadCursor cursor)
 {
     // Create an attempted move if there is a selected piece
     if (InputManager.Instance.Selected != null)
     {
         // Generate potential move and save it in InputManager
         Debug.Log("Selected: " + InputManager.Instance.Selected);
         Debug.Log("Piece Row&Col: " + InputManager.Instance.Selected.Z + " - " + InputManager.Instance.Selected.X);
         Debug.Log("Piece Index: " + InputManager.Instance.Selected.Index);
         Debug.Log("Tile Row&Col: " + Row + " - " + Col);
         Move move = new Move(InputManager.Instance.Selected.Index, Board.IndexFromRowAndCol(Row, Col));
         Debug.Log("New Move: " + move.From + " - " + move.To);
         Debug.Log("Invalid Move?: " + move.Invalid);
         InputManager.Instance.AttemptMove(move);
     }
 }
Пример #2
0
    /// <summary>
    /// Select or deselect the piece when it is clicked on (if it can be selected)
    /// </summary>
    public override void OnClick(GamepadCursor cursor)
    {
        // Select the piece if it is possible
        if (!selected)
        {
            selected       = true;
            material.color = selectedColor;

            // Deselect old piece and select this piece
            if (InputManager.Instance.Selected != null)
            {
                Debug.Log("Deselected");
                InputManager.Instance.Selected.selected = false;
            }
            InputManager.Instance.Selected = this;
        }
        // Deselect the piece if it is selected
        else
        {
            selected       = false;
            material.color = defaultColor;
            InputManager.Instance.Selected = null;
        }
    }
Пример #3
0
 public abstract void OnClick(GamepadCursor cursor);