Esempio n. 1
0
        public static TimerEvent Add(TimerEventName name, float triggerTime, float deltaTime, Command command)
        {
            TimerManager timerMan   = TimerManager.GetInstance();
            TimerEvent   timerEvent = (TimerEvent)timerMan.BaseAdd();

            Debug.Assert(timerEvent != null);
            timerEvent.Set(name, triggerTime, deltaTime, command);
            timerMan.BaseInsertSorted(timerEvent);
            return(timerEvent);
        }
Esempio n. 2
0
        public static TimerEvent Add(TimerEvent.Name timeName, Command pCommand, float deltaTimeToTrigger, bool repeat = true)
        {
            Debug.Assert(pCommand != null);
            Debug.Assert(deltaTimeToTrigger >= 0.0f);

            TimerMan pTimerMan = TimerMan.PrivGetInstance();

            Debug.Assert(pTimerMan != null);

            float      triggerTime = deltaTimeToTrigger + pTimerMan.mCurrTime;
            TimerEvent pPreNode    = PrivLocateNode(triggerTime);

            TimerEvent pNode = (TimerEvent)pTimerMan.BaseAddToPosition(pPreNode);

            Debug.Assert(pNode != null);
            pNode.Set(timeName, pCommand, deltaTimeToTrigger, pTimerMan.mCurrTime, repeat);

            return(pNode);
        }
        //----------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------
        public static TimerEvent Add(TimerEvent.Name timeName, Command pCommand, float deltaTimeToTrigger)
        {
            TimerEventManager pMan = TimerEventManager.privGetInstance();

            Debug.Assert(pMan != null);

            //pull a resereved node
            TimerEvent pNode = (TimerEvent)pMan.basePopReserve();

            Debug.Assert(pNode != null);

            Debug.Assert(pCommand != null);
            Debug.Assert(deltaTimeToTrigger >= 0.0f);

            //set the data
            pNode.Set(timeName, pCommand, deltaTimeToTrigger);

            //add the newly set timer event node to the list in sorted order
            pMan.baseAddSorted(pNode);

            return(pNode);
        }