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); } } }
private void OnDisable() { if (_timer) { _timer.Stop(); } }
/// <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); } }
private void KillEffect() { timer.Stop(); Debug.Log("End of spell effect " + name); transform.SetParent(null); Destroy(this); //Destroy(this.GetComponent<GameObject>()); }
public virtual void Stop() { if (_timer == null) { return; } _timer.Stop(); _timer = null; }
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); }
public void StopCasting(bool canceled) { print("Castbar: Cast finished"); isCasting = false; timer.Stop(); castSlider.value = 0; DisplayCastBar(false); if (canceled && OnCastingCanceled != null) { OnCastingCanceled(); } }
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; } } }
/// <summary> /// 停止运行时间 /// </summary> public void StopTime() { simpleTimer.Stop(); }
public virtual void Disconnect() { _timer?.Stop(); DismissCurrentConnection(); _proxy = null; }
static void StopTimersOverhead() { TimersOverhead.Stop(); }