Ejemplo n.º 1
0
 void Awake()
 {
     player     = GetComponent <PlayerController>();
     state      = new IdleState(player);
     stateTimer = GetComponent <StateTimer>();
     cooldowns  = GetComponent <PlayerCooldowns>();
 }
Ejemplo n.º 2
0
        private void SetUpClock()
        {
            stateTimer   = new StateTimer();
            programTimer = new ProgramTimer();

            stateTimer.StateTimeChanged     += StateTimer_StateTimeChanged;
            programTimer.ProgramTimeChanged += ProgramTimer_ProgramTimeChanged;
        }
Ejemplo n.º 3
0
 /// <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();
 }
Ejemplo n.º 4
0
        private void SetTimer()
        {
            StateTimer.Interval = 60000;
            StateTimer.Tick    += (sender, e) =>
            {
                DatetoolStripStatusLabel.Text = DateTime.Now.ToLongDateString();
            };

            StateTimer.Start();
        }
Ejemplo n.º 5
0
        /// <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;
        }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 9
0
 protected override void OnStop()
 {
     StateTimer.Dispose();
     th = null;
 }
Ejemplo n.º 10
0
 protected override void OnStop()
 {
     Library.WriteErrorLog("test stop \n");
     StateTimer.Dispose();
 }
 /// <summary>
 /// Dispose fitness tracker.
 /// </summary>
 public void Dispose()
 {
     StateTimer.Dispose();
     Sensors = null;
 }
Ejemplo n.º 12
0
 protected override void OnStop()
 {
     WriteEventLogEntry("WindowsService2 Stop");
     Library.WriteErrorLog("Service Stop !!! \n");
     StateTimer.Dispose();
 }
Ejemplo n.º 13
0
 public AIController()
 {
     mDurdleTimer = new StateTimer<DurdleState>(DurdleState.Idle);
     ResetAIState();
 }
Ejemplo n.º 14
0
 public NpcState()
 {
     Action    = CurrentAction.IdleStanding;
     _state    = new StateTimer();
     _movement = new MovementTimer();
 }