Beispiel #1
0
    //Takes in vertex position and the colliding wall and increments y appropriately
    protected float ClimbWall(Vector2 vertex, int i, WallScript trueColliderScript)
    {
        float y = vertex.y;

        Vector2 point     = trueColliderScript.GetClosestPoint((Vector3)vertex + transform.position);
        float   distToEnd = Mathf.Min(Mathf.Abs(vertex.x + transform.position.x - point.x), Mathf.Abs(vertex.y + transform.position.y - point.y));

        if (vertex.y > 0)
        {
            y = (vertex.y + (distToEnd * Y_MULTIPLIER));
        }
        else
        {
            y = (vertex.y + distToEnd);
        }

        return(y);
    }