Exemplo n.º 1
0
    public override HeroState Update_(HeroMover hero, float deltatime)
    {
        var params_ = hero.Parameters;

        hero.ApplyGravity(params_.BendParams.Gravity, params_.MoveInAirParams.FallSpeedMax, deltatime);

        if (hero.IsOnGround)
        {
            hero.ApplyFriction(hero.Parameters.RunParams.Friction, deltatime);
        }

        secondsAfterEnter += deltatime;
        if (secondsAfterEnter >= hero.Parameters.BendParams.BendBackSeconds)
        {
            return(new StateFall());
        }

        return(this);
    }
Exemplo n.º 2
0
    public override HeroState Update_(HeroMover hero, float deltatime)
    {
        if (hero.IsOnGround)
        {
            fromNoGround = 0f;
        }
        else
        {
            fromNoGround += deltatime;
            if (fromNoGround >= hero.Parameters.RunParams.CoyoteTime)
            {
                return(new StateFall());
            }
        }

        hero.velocity.Y = 0;

        hero.ApplyFriction(hero.Parameters.RunParams.Friction, deltatime);

        return(this);
    }