Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     testTimer.Tick();
     if (testTimer.state == MyTimer.STATE.FINISHED)
     {
         Debug.Log("the timer already finished");
     }
 }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (recording)
     {
         recordingTimer.Tick();
         timeTxt.text = GetTimeTxt((int)recordingTimer.ElpsedTime) + "/" + GetTimeTxt((int)totalTime);
         if (recordingTimer.state == MyTimer.STATE.FINISHED)
         {
             StopRecording();
         }
     }
 }
Esempio n. 3
0
        public void Tick(bool input)
        {
            extTimer.Tick();
            delayTimer.Tick();

            curState = input;

            IsPressing = curState;

            OnPressed   = false;
            OnReleased  = false;
            IsExtending = false;
            IsDelaying  = false;

            if (curState != lastState)
            {
                if (curState == true)
                {
                    OnPressed = true;
                    StartTimer(delayTimer, delayingDuration);
                }
                else
                {
                    OnReleased = true;
                    StartTimer(extTimer, extendingDuration);
                }
            }

            lastState = curState;

            if (extTimer.state == MyTimer.STATE.RUN)
            {
                IsExtending = true;
            }

            if (delayTimer.state == MyTimer.STATE.RUN)
            {
                IsDelaying = true;
            }
        }