Exemplo n.º 1
0
    void Update(float REAL_DELTA, float TIMESCALE_DELTA)
    {
        //skip the ones that were completed, works with DontDisposeOnComplete flag
        if (behaviorBase.Completed)
        {
            return;
        }
        //first check for potential problems
        behaviorBase.CheckErrors();

        if (type == TimeDeltaType.TimeScaleDependent)
        {
            behavior.Update(TIMESCALE_DELTA);
        }
        else
        {
            behavior.Update(REAL_DELTA);
        }

        TimePassedTotal = behaviorBase.TotalTimeActive;
        TimePassed      = behaviorBase.TimePassed;
        TimeLeft        = MainInterval - TimePassed;

        if (OnUpdate != null)
        {
            OnUpdate();
        }
        //Notify pool if we completed work
        if (behaviorBase.Completed)
        {
            if (DontDisposeOnComplete)
            {
                return;
            }
            OnStopped(this);
            return;
        }
    }