コード例 #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);
        }
コード例 #2
0
ファイル: TimerMan.cs プロジェクト: Carsonq/SpaceInvaders
        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);
        }
コード例 #3
0
        //----------------------------------------------------------------------
        // 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);
        }