Ejemplo n.º 1
0
 public void Wash()
 {
     this.name        = Name.Blank;
     this.pCommand    = null;
     this.triggerTime = 0.0f;
     this.deltaTime   = 0.0f;
 }
Ejemplo n.º 2
0
 public TimerEvent()
     : base()
 {
     this.name        = Name.Blank;
     this.pCommand    = null;
     this.triggerTime = 0.0f;
     this.deltaTime   = 0.0f;
 }
Ejemplo n.º 3
0
        public void Set(TimerEvent.Name name, Command pCommand, float deltaTimeToTrigger, float currTime, bool repeat = true)
        {
            Debug.Assert(pCommand != null);

            this.name        = name;
            this.pCommand    = pCommand;
            this.deltaTime   = deltaTimeToTrigger;
            this.triggerTime = currTime + deltaTimeToTrigger;
            this.repeat      = repeat;
        }
Ejemplo n.º 4
0
        public void Set(Name eventName, Command pCommand, float deltaTimeToTrigger)
        {
            Debug.Assert(pCommand != null);

            this.name      = eventName;
            this.pCommand  = pCommand;
            this.deltaTime = deltaTimeToTrigger;

            // set the trigger time
            this.triggerTime = TimerEventManager.GetCurrTime() + deltaTimeToTrigger;
        }
Ejemplo n.º 5
0
        // PA2: Factory method, create and add image into actives
        public TimerEvent Add(TimerEvent.Name name, Command cmd, float deltaTimeToTrigger)
        {
            // Create a new image
            TimerEvent ret = (TimerEvent)this.PullFromReserved();

            ret.name        = name;
            ret.pCommand    = cmd;
            ret.deltaTime   = deltaTimeToTrigger;
            ret.triggerTime = this.currentTime + deltaTimeToTrigger;

            // Add it to the list
            this.AddAndSort(ref this.poActiveHead, ref this.pActiveEnd, ret);

            return(ret);
        }
Ejemplo n.º 6
0
        public static TimerEvent Find(TimerEvent.Name name)
        {
            TimerEventManager pMan = TimerEventManager.privGetInstance();

            Debug.Assert(pMan != null);
            // Compare functions only compares two Nodes

            // So:  Use a reference node
            //      fill in the needed data
            //      use in the Compare() function
            Debug.Assert(pTimerEventRef != null);
            pTimerEventRef.Wash();
            pTimerEventRef.SetName(name);

            TimerEvent pData = (TimerEvent)pMan.baseFindNode(pTimerEventRef);

            return(pData);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
 public void SetName(Name inName)
 {
     this.name = inName;
 }