示例#1
0
    public static bool DirectionDown(Parameters.InputDirection dir)
    {
        if (!gameplayEnabled)
        {
            return(false);
        }

        //Hacky, probably should fix to be correct later
        Parameters.InputDirection currentInput = getInputDirection();
        return(currentInput == dir);
    }
示例#2
0
    //Returns an open position in the specified direction that is at most maxDistance away
    public static Vector2 getOpenLocation(Parameters.InputDirection direction, Vector2 startingPosition, float maxDistance = 1.0f)
    {
        Vector2 newPosition       = startingPosition;
        Vector2 increment         = new Vector2(0, 0);
        float   incrementDistance = 0.1f;
        float   currentDistance   = 0.0f;

        increment = Parameters.InputDirToVector(direction) * incrementDistance;
        while (pointCollides(newPosition))
        {
            currentDistance += incrementDistance;
            newPosition     += increment;

            if (currentDistance > maxDistance)
            {
                return(startingPosition);
            }
        }
        return(newPosition + (10f * currentDistance * increment));
    }