예제 #1
0
    public bool CanMove()
    {
        Spot spot = GetComponentInParent <Spot>();

        //If the piece is not yet on the board, it can be moved onto the board
        if (spot == null)
        {
            return(true);
        }
        //If there are pieces not on the board yet, move those first
        else if (!Piece.AllOnBoard(playerID))
        {
            return(false);
        }

        //If "flying" is enabled, and the player is down to their last three pieces
        if (GameStateManager.ALLOW_FLYING && Piece.Count(playerID) == 3)
        {
            return(true);
        }

        foreach (GameObject spotObject in spot.Neighbours)
        {
            //If there is an empty neighbour, we can move there
            if (spotObject.GetComponentInChildren <Piece>() == null)
            {
                return(true);
            }
        }

        return(false);
    }