Exemple #1
0
    public override void Start(float duration)
    {
        ViDebuger.AssertWarning(Target);
        if (Target == null)
        {
            Target = new ViSimpleProvider <ViVector3>();
        }
        _velocity = ViVector3.ZERO;
        _duration = ViMathDefine.Max(0.01f, duration);
        ViVector3 targetPos    = Target.Value;
        float     distanceH    = ViMath2D.Length(targetPos.x, targetPos.y, Translate.x, Translate.y);
        float     distanceV    = targetPos.z - Translate.z;
        float     time         = distanceV / m_GravityAcc / _duration;
        float     preDeltaTime = _duration * 0.5f + time;
        float     aftDeltaTime = _duration * 0.5f - time;

        _velocity.z = preDeltaTime * m_GravityAcc;
    }
Exemple #2
0
    public static void Test()
    {
        Listener listener = new Listener();
        ViSimpleProvider <ViVector3> provider0 = new ViSimpleProvider <ViVector3>();
        ViSimpleProvider <ViVector3> provider1 = new ViSimpleProvider <ViVector3>();

        provider0.SetValue(new ViVector3(0, 0, 0));
        provider0.SetValue(new ViVector3(0, 0, 0));
        ViDistNotifier distanceNotifier = new ViDistNotifier();

        distanceNotifier.SetRange(10.0f);
        distanceNotifier.SetTarget(provider0, provider1);
        distanceNotifier.AttachUpdate(listener.OnIn, listener.OnOut);
        ViDistNotifier.UpdateList();
        provider1.SetValue(new ViVector3(11, 0, 0));
        ViDistNotifier.UpdateList();
        provider1.SetValue(new ViVector3(9, 0, 0));
        ViDistNotifier.UpdateList();
    }