Stop() public method

stop pauses the timer and allows for resume at current elapsed time
public Stop ( ) : void
return void
Ejemplo n.º 1
0
    private void UpdatePlayerVisibility()
    {
        if (isPlayerVisible == (isPlayerVisible = state != State.Turning && lantern.IsPlayerVisible))
        {
            return;
        }
        if (isPlayerVisible)
        {
            if (!isPlayerConsideredVisible)
            {
                state = State.Following;
                damageTimer.Reset(damageTime);
                OnDetected();
            }

            isPlayerConsideredVisible = true;
            looseVisibilityTimer.Stop();
        }
        else
        {
            if (looseVisibilityTimer.Elapsed)
            {
                looseVisibilityTimer.Reset(visibilityPadTime);
            }
        }
    }
Ejemplo n.º 2
0
 private void OnDisable()
 {
     if (_timer)
     {
         _timer.Stop();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This function should not be called often. Instead, its results should be cached and then GetTimer(int) used instead.
        /// The function itself incorporate thread id in the name for timing parallel code
        /// </summary>
        /// <param name="names">names of timer hierarchy</param>
        /// <returns>id of the timer to be used with GetTimer</returns>
        public int GetTimerId(params string[] names)
        {
            TimersOverhead.Start();

            Debug.Assert(names != null && names.Length > 0, "Must pass at least one name to the GetTimerId");
            Timer parent = null;

            int timerIndex = 0;
            var nameIndex  = 0;

            for (; timerIndex < _timers.Count; ++timerIndex)
            {
                var timer = _timers[timerIndex];
                if (timer.Parent == parent)
                {
                    if (timer.Name == names[nameIndex])
                    {
                        parent = timer;
                        ++nameIndex;
                        if (nameIndex >= names.Length)
                        {
                            TimersOverhead.Stop();
                            return(timerIndex);
                        }
                    }
                }
            }
            //We did not find the rest of the timers, now we should add them
            lock (this)
            {
                var newTimersCount = names.Length - nameIndex;
                if (_timers.Capacity < newTimersCount)
                {
                    _timers.Capacity = newTimersCount;
                }

                do
                {
                    parent = new Timer(parent, names[nameIndex++]);
                    _timers.Add(parent);
                } while (nameIndex < names.Length);

                TimersOverhead.Stop();
                return(_timers.Count - 1);
            }
        }
Ejemplo n.º 4
0
    private void KillEffect()
    {
        timer.Stop();
        Debug.Log("End of spell effect " + name);

        transform.SetParent(null);
        Destroy(this);
        //Destroy(this.GetComponent<GameObject>());
    }
Ejemplo n.º 5
0
 public virtual void Stop()
 {
     if (_timer == null)
     {
         return;
     }
     _timer.Stop();
     _timer = null;
 }
Ejemplo n.º 6
0
 public void StopHeartBeat(GameObject obj)
 {
     bStartHeartBeat   = false;
     BadNetTimer.tick -= BadNetCondition;
     BadNetTimer.Stop();
     ReLoginTimer.tick -= ReturnToLogin;
     ReLoginTimer.Stop();
     FightNew.FightMgr.Instance.ClearLevel();
     UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(0);
     SendReConnect();
     SetReConnect(true);
 }
Ejemplo n.º 7
0
    public void StopCasting(bool canceled)
    {
        print("Castbar: Cast finished");
        isCasting = false;
        timer.Stop();
        castSlider.value = 0;
        DisplayCastBar(false);

        if (canceled && OnCastingCanceled != null)
        {
            OnCastingCanceled();
        }
    }
Ejemplo n.º 8
0
    void Update()
    {
        if (coolDownTimer != null && onCooldown)
        {
            coolDownSlider.value = 1 - (float)coolDownTimer.GetElapsedTimeSecs() / spellData.coolDown;

            if (coolDownTimer.GetElapsedTimeSecs() >= spellData.coolDown)
            {
                coolDownTimer.Stop();
                onCooldown = false;

                butt.enabled         = true;
                fillCanvas.enabled   = false;
                coolDownSlider.value = 1;
            }
        }
    }
Ejemplo n.º 9
0
 /// <summary>
 /// 停止运行时间
 /// </summary>
 public void StopTime()
 {
     simpleTimer.Stop();
 }
 public virtual void Disconnect()
 {
     _timer?.Stop();
     DismissCurrentConnection();
     _proxy = null;
 }
Ejemplo n.º 11
0
 static void StopTimersOverhead()
 {
     TimersOverhead.Stop();
 }