Esempio n. 1
0
    }     //initialising data

    private void Update()
    {
        UodateSelectionr(); //updating mouse position
        if (Input.GetMouseButtonDown(0))
        {
            if (selectionX >= 0 && selectionY >= 0) //if the mouse position is inside the board
            {
                //selecting or moving piece
                if (selectedPices == null)
                {
                    SelectPices(selectionX, selectionY);
                }
                else
                {
                    MovePices(selectionX, selectionY);
                }
            }
        } //when mouse clicked
        if (Input.GetKeyDown("p"))
        {
            List <string> Moveses = AllMoves();
            for (int i = 0; i < Moveses.Count; i++)
            {
                print(Moveses[i]);
            }
        } //find all moves
        if (Input.GetKeyDown("r"))
        {
            ReversMove();
        } //reverse button
        if (Input.GetKeyDown("n"))
        {
            Pices c = selectedPices.GetComponent <Pices>();
            print(c.CurrentX + ":" + c.CurrentY);
        } //Selected pice letter
        if (Input.GetKeyDown("h"))
        {
            foreach (string m in MoveHistory)
            {
                print(m);
            }
        } //Print history
        if (Input.GetKeyDown("l"))
        {
            print(MoveHistory.Count);
        }
    } //gameloop