void Awake() { player = GetComponent <PlayerController>(); state = new IdleState(player); stateTimer = GetComponent <StateTimer>(); cooldowns = GetComponent <PlayerCooldowns>(); }
private void SetUpClock() { stateTimer = new StateTimer(); programTimer = new ProgramTimer(); stateTimer.StateTimeChanged += StateTimer_StateTimeChanged; programTimer.ProgramTimeChanged += ProgramTimer_ProgramTimeChanged; }
/// <summary> /// Saves the current state time spent on. /// </summary> void SaveTimer() { StateTimer.Stop(); if (StateTimer.ElapsedMilliseconds >= 1000) { TimerList.Add(new Tuple <string, double> (currentState, StateTimer.ElapsedSeconds)); } StateTimer.Reset(); }
private void SetTimer() { StateTimer.Interval = 60000; StateTimer.Tick += (sender, e) => { DatetoolStripStatusLabel.Text = DateTime.Now.ToLongDateString(); }; StateTimer.Start(); }
/// <summary> /// Handles when navigation event has been thrown. /// </summary> /// <param name="evt">Evt.</param> void HandleNavigationEvent(NavigationEvent evt) { string NextEvent = evt.Name; if (!string.IsNullOrEmpty(currentState) && (NextEvent != currentState)) { SaveTimer(); } StateTimer.Start(); currentState = NextEvent; }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { StateTimer.Stop(); try { _ = _server.ShutDown(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Stop sensors interrogating & health tracking. /// </summary> public void Stop() { if (StateTimer == null) { Console.WriteLine("\nFitness tracker is not started yet!"); return; } StateTimer.Change(Timeout.Infinite, Timeout.Infinite); Console.WriteLine("\nFitness tracker is stopped!"); _isActive = false; }
/// <summary> /// Start sensors interrogating & health tracking. /// </summary> public void Run() { if (StateTimer == null) { StateTimer = new Timer(Sensors.CheckStatus, state: null, dueTime: CheckInteval, period: CheckInteval); } else { StateTimer.Change(dueTime: CheckInteval, period: CheckInteval); } _isActive = true; }
protected override void OnStop() { StateTimer.Dispose(); th = null; }
protected override void OnStop() { Library.WriteErrorLog("test stop \n"); StateTimer.Dispose(); }
/// <summary> /// Dispose fitness tracker. /// </summary> public void Dispose() { StateTimer.Dispose(); Sensors = null; }
protected override void OnStop() { WriteEventLogEntry("WindowsService2 Stop"); Library.WriteErrorLog("Service Stop !!! \n"); StateTimer.Dispose(); }
public AIController() { mDurdleTimer = new StateTimer<DurdleState>(DurdleState.Idle); ResetAIState(); }
public NpcState() { Action = CurrentAction.IdleStanding; _state = new StateTimer(); _movement = new MovementTimer(); }