Пример #1
0
 internal void RaiseOnSleep(string sender = null)
 {
     if (OnSleep != null)
     {
         OnSleep.BeginInvoke(sender, null, null);
     }
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        public void SleepMobs()
        {
            Parallel.ForEach(_repository.Keys,
                             bucket => Parallel.ForEach(_repository.Get(bucket),
                                                        agent => agent.Sleep()));

            OnSleep?.Invoke(this, null);
        }
        private void sessionInformation_SessionDeactivated(object sender, EventArgs e)
        {
            Trace.WriteLine("sessionInformation_SessionDeactivated");

            if (OnSleep != null)
            {
                OnSleep.Invoke(this, null);
            }
        }
Пример #4
0
        protected override void Run(CancellationToken cancellationToken)
        {
            //Running = true;
            var loopCycles = 0;

            while (!cancellationToken.IsCancellationRequested)
            {
                int cycles = _trainer.Emulator.PreExecute();

                if (_trainer.BreakpointsEnabled && _trainer.AtBreakPoint && lastBreakPointPC != _trainer.State.PC)
                {
                    Stop(true);
                    _trainer.RaiseStopEvent();
                    lastBreakPointPC = _trainer.State.PC;
                    break;
                }
                else
                {
                    lastBreakPointPC = -1;
                }

                if (cycles == 0)
                {
                    cycles = _trainer.Emulator.PostExecute();
                }

                loopCycles += cycles;

                lock (lockCycles)
                {
                    _cycles += cycles;
                }


                if (loopCycles > limit)
                {
                    loopCycles = 0;
                    OnSleep?.Invoke(this, new EventArgs());
                    manualResetEventSlim.Wait(20);
                    sleeps++;
                }
            }
            resetEvent.Set();
            Running = false;
        }
Пример #5
0
    private IEnumerator SleepSequence()
    {
        while (true)
        {
            yield return(GetSleepTime());

            OnWokeUp?.Invoke();
            IsSleeping         = false;
            Renderer.color     = _baseColor;
            transform.rotation = Quaternion.identity;
            yield return(new WaitForSeconds(0.5f));

            OnSleep?.Invoke();
            IsSleeping         = true;
            Renderer.color     = _sleepColor;
            transform.rotation = Quaternion.Euler(_sleepRot);
        }
    }
Пример #6
0
 public void SetDelegate(FireController fireController)
 {
     dOnSleep = fireController.OnSleepBullet;
     //dOnSleep = new OnSleep(fireController.OnSleepBullet);
 }
Пример #7
0
 private void OnOnSleep()
 {
     OnSleep?.Invoke(this, EventArgs.Empty);
 }