Exemple #1
0
    public void Refresh(float dt)
    {
        _time += dt;

        float speed = _velocityCurve.Evaluate(_time);

        _currentVelocity = _velocity * speed;

        _currentAngular = _angularCurve.Evaluate(_time) * _angular;
    }
Exemple #2
0
    public bool Actualize(float dt)
    {
        _time += dt;

        if (_time < _current.duration)
        {
            float ct = _current.Evaluate(_time);
            transform.position = Vector3.Lerp(_from, _to, ct);
            return(false);
        }
        else
        {
            SetVisible(_current == _inCurve);
            return(_current == _outCurve);
        }
    }
Exemple #3
0
    Vector3 ComputeControlPoint(EvaluationCurve xyCurve,
                                EvaluationCurve yCurve,
                                float time,
                                Vector3 from,
                                Vector3 to)
    {
        Vector2 from2D = WorldConversion.ToVector2(from);
        Vector2 to2D   = WorldConversion.ToVector2(to);

        float   distance01 = xyCurve.Evaluate(time);
        Vector2 pos2D      = (to2D - from2D) * distance01 + from2D;

        float y01 = yCurve.Evaluate(time);
        float y   = (to.y - from.y) * y01 + from.y;

        return(new Vector3(pos2D.x, y, pos2D.y));
    }