示例#1
0
    private Vector2Int findMoveDirection(int correctInputs)
    {
        //for testing
//        return Vector2Int.right;

        Debug.Log("correct inputs: " + correctInputs);

        int incorrectInputs = 3 - correctInputs;

        if (incorrectInputs < 0)
        {
            incorrectInputs = 0;
        }

        if (incorrectInputs > 3)
        {
            incorrectInputs = 3;
        }

        preMoveDirectionIndex = GlobalVar.GetNextMoveDirectionIndex(preMoveDirectionIndex, incorrectInputs);
        return(GlobalVar.GetMoveDirection(preMoveDirectionIndex, currentPosition));

        Vector2Int moveDirection = Vector2Int.zero;

        if (correctInputs == 3)
        {
            moveDirection = Vector2Int.right;
        }
        else if (correctInputs == 2)
        {
            moveDirection = playerNumber == 1 ? Vector2Int.one : Vector2Int.down;
        }
        else if (correctInputs == 1)
        {
            moveDirection = playerNumber == 1 ? Vector2Int.up : -Vector2Int.one;
        }
        else
        {
            moveDirection = Vector2Int.left;
        }

//        bool adjustGridCoordinate = correctInputs == 2 || correctInputs == 1;
//        if(adjustGridCoordinate && currentPosition.y % 2 == 0) {
//            moveDirection = moveDirection + Vector2Int.left;
//        }

        return(moveDirection);
    }