コード例 #1
0
ファイル: TimerMan.cs プロジェクト: xfanw/SpaceInvaders_new
        public static TimeEvent Add(TimeEvent.NAME name, Command pCommand, float deltaTimeToTrigger)
        {
            Debug.Assert(pMan != null);

            TimeEvent pEvent = (TimeEvent)pMan.baseAdd();

            Debug.Assert(pEvent != null);

            Debug.Assert(pCommand != null);

            pEvent.Set(name, pCommand, deltaTimeToTrigger);
            return(pEvent);
        }
コード例 #2
0
        public static TimeEvent Add(TimeEvent.Name timeName, Command pCmd, float timeToTrigger)
        {
            TimerManager pMan = TimerManager.privGetInstance();

            Debug.Assert(pMan != null);

            TimeEvent pNode = (TimeEvent)pMan.baseAdd();

            Debug.Assert(pNode != null);
            Debug.Assert(pCmd != null);
            Debug.Assert(timeToTrigger >= 0.0f);

            pNode.Set(timeName, pCmd, timeToTrigger);
            return(pNode);
        }
コード例 #3
0
        public static TimeEvent Add(TimeEvent.Name timeName, Command pCommand, float deltaTimeToTrigger)
        {
            TimerMan pMan = TimerMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            TimeEvent pNode = (TimeEvent)pMan.baseAddSorted(deltaTimeToTrigger + GetCurrTime());

            Debug.Assert(pNode != null);

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

            pNode.Set(timeName, pCommand, deltaTimeToTrigger);
            return(pNode);
        }
コード例 #4
0
        public static TimeEvent Add(TimeEvent.Name timeName, Command pCommand, float deltaTimeToTrigger)
        {
            //TimerMan pMan = TimerMan.privGetInstance();
            TimerMan pMan = TimerMan.pActiveTmMan;

            Debug.Assert(pMan != null);

            TimeEvent pNode = TimerMan.privSortedAdd(deltaTimeToTrigger);

            Debug.Assert(pNode != null);

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

            pNode.Set(timeName, pCommand, deltaTimeToTrigger);
            return(pNode);
        }
コード例 #5
0
        public static TimeEvent Add(TimeEvent.Name timeName, Command pCommand, float deltaTimeToTrigger)
        {
            TimerManager pMan = TimerManager.pActiveMan;

            Debug.Assert(pMan != null);

            //TimeEvent pNode = (TimeEvent)pMan.BaseAdd();
            TimeEvent pNode = (TimeEvent)pMan.BaseSortedAdd(deltaTimeToTrigger);

            Debug.Assert(pNode != null);

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

            pNode.Set(timeName, pCommand, deltaTimeToTrigger);
            return(pNode);
        }
コード例 #6
0
        public static TimeEvent Add(TimeEvent.Name EventName, Command pCommand, float deltaTime)
        {
            Debug.Assert(pCommand != null);
            Debug.Assert(deltaTime > 0.0f);

            TimerManager pMan = TimerManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            // Take a node out from Reserve list.
            // This node is washed in BasePopNode().
            TimeEvent pNode = (TimeEvent)pMan.BasePopNode();

            Debug.Assert(pNode != null);

            pNode.Set(EventName, pCommand, deltaTime);
            pMan.BaseSortedAdd(pNode);
            return(pNode);
        }
コード例 #7
0
        public static TimeEvent Add(TimeEvent.Name eventName, Command pCommand, float deltaTimeToTrigger)
        {
            TimerManager pInstance = TimerManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            // Retrieve a node from Reserve list
            TimeEvent pNewNode = (TimeEvent)pInstance.BaseGetNodeFromReserve();

            Debug.Assert(pNewNode != null);

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

            // Set TimerEvent attributes
            pNewNode.Set(eventName, pCommand, deltaTimeToTrigger);

            // Add to Active List in sorted order
            AddToActiveListInSortedOrder(pInstance, pNewNode);

            return(pNewNode);
        }
コード例 #8
0
        //needs to insert as a priority queue
        public static TimeEvent Add(TimeEvent.Name name, Command pCommand, float deltaTime)
        {
            Debug.Assert(pCommand != null);

            //real-time systems  must be causal
            //cant have an event occur before current time
            Debug.Assert(deltaTime >= 0.0f);

            TimerMan pTMan = TimerMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            TimeEvent pTEnode = (TimeEvent)pTMan.GrabNode();

            Debug.Assert(pTEnode != null);

            //the TimeEvent class does the updated trigger time
            pTEnode.Set(name, pCommand, deltaTime);


            Insert(pTEnode);
            return(pTEnode);
        }