Exemplo n.º 1
0
        private void SetInputValue(float value)
        {
            Value           = value;
            lastActiveFrame = Time.frameCount;

            onInputTCS?.TrySetResult(Active);
            onInputTCS = null;
            if (Active)
            {
                onInputStartTCS?.TrySetResult(null);
                onInputStartTCS = null;
                onInputStartCTS?.Cancel();
                onInputStartCTS?.Dispose();
                onInputStartCTS = null;
            }
            else
            {
                onInputEndTCS?.TrySetResult(null);
                onInputEndTCS = null;
                onInputEndCTS?.Cancel();
                onInputEndCTS?.Dispose();
                onInputEndCTS = null;
            }

            if (Active)
            {
                OnStart?.Invoke();
            }
            else
            {
                OnEnd?.Invoke();
            }
        }
Exemplo n.º 2
0
 public async void RaiseOnEnd()
 {
     if (OnEnd != null)
     {
         await OnEnd.Invoke();
     }
 }
Exemplo n.º 3
0
 public void Update()
 {
     if (timerType == TimerType.Countdown)
     {
         if (isPlaying && !paused)
         {
             if (timeElapsed > 0)
             {
                 timeElapsed -= Time.deltaTime;
             }
             else
             {
                 timeElapsed = 0;
                 isPlaying   = false;
                 OnEnd?.Invoke();
             }
         }
     }
     else if (timerType == TimerType.Chronometer)
     {
         if (isPlaying && !paused)
         {
             timeElapsed += Time.deltaTime;
         }
     }
 }
Exemplo n.º 4
0
        public void Reveal(int row, int col)
        {
            TestCoord(row, col, nameof(Reveal));

            if (UnsField[row, col] != Hidden)
            {
                return;
            }

            UnsField[row, col] = SolField[row, col];

            OnMove?.Invoke(this, new MoveArgs(row, col, Move.Reveal, UnsField[row, col]));

            if (UnsField[row, col] == Mine)
            {
                OnEnd?.Invoke(this, new ResultArgs(GameResult.Lost));
                return;
            }

            if (UnsField[row, col] == 0)
            {
                foreach ((int nRow, int nCol) in GetAdj(row, col))
                {
                    Reveal(nRow, nCol);
                }
            }

            if (Game.HasWon())
            {
                OnEnd?.Invoke(this, new ResultArgs(GameResult.Won));
            }
        }
Exemplo n.º 5
0
        public void Start()
        {
            if (racers.Count == 0)
            {
                OnEnd?.Invoke();
                return;
            }

            UpdateLeaderboards();

            Checkpoint start = checkpoints[0];

            foreach (RacePlayer player in this.racers)
            {
                start.SetRaceVisibility(player, true, true);


                player.SetHudComponentVisible(HudComponent.all, false);
                player.SetHudComponentVisible(HudComponent.radar, true);
            }

            SpawnVehicles();

            System.Timers.Timer timer = new System.Timers.Timer(500);
            timer.AutoReset = false;
            timer.Elapsed  += (object source, ElapsedEventArgs args) =>
            {
                WarpPlayersIntoVehicles();
            };
            timer.Start();

            this.hasStarted = true;
        }
Exemplo n.º 6
0
    private IEnumerator ActivateFight()
    {
        if (waveNow < Waves.Length)
        {
            Wave        W = Waves[waveNow];
            Starship_AI E;
            for (int i = 0; i < W.enemiesCount; ++i)
            {
                Spawn.position = enemiesStartPosition;
                v3             = Vector3.Scale(Vector3.Scale(SpawnEnd.up, SpawnEnd.up), enemiesStartPosition) + W.Spawns[i].position - Vector3.Scale(Vector3.Scale(SpawnEnd.up, SpawnEnd.up), W.Spawns[i].position);
                E = Instantiate(EnemiesPrefabs[W.EnemyType], v3, W.Spawns[i].rotation).GetComponent <Starship_AI>();
                Enemies.Push(E);
                E.transform.parent = Spawn;
                E.SetPlayerHunt(false);
                E.SetControlLock(true);
                E.GetComponent <Health>().OnDeath += EnemyDeath;
            }
            StartCoroutine(IMoveEnemies());
        }
        else
        {
            OnEnd?.Invoke();
            yield return(StartCoroutine(ExitDoor.IMove()));

            Destroy(this);
        }
    }
Exemplo n.º 7
0
        public void Execute()
        {
            OnStart?.Invoke(_aggregate);

            try
            {
                foreach (var step in _steps)
                {
                    _aggregate.ExecuteStep(step);

                    OnStepProcessed?.Invoke(_aggregate);
                }

                _aggregate.WorkingDirectory.DeleteWithContentIfExists();
            }
            catch (Exception ex)
            {
                OnExceptionOccured?.Invoke(_aggregate, ex);
#if DEBUG
                throw;
#endif
            }

            OnEnd?.Invoke(_aggregate);
        }
Exemplo n.º 8
0
 public void EndRequest(ServiceContext context)
 {
     _info.Action   = context.Action.Name;
     _info.EndDate  = DateTime.UtcNow;
     _info.Duration = (int)(_info.EndDate - _info.StartDate).TotalMilliseconds;
     OnEnd?.Invoke(this, context);
 }
Exemplo n.º 9
0
 private void OnNotified(float deltaTime)
 {
     if (!Active)
     {
         return;
     }
     if (currentTime < _waitTime)
     {
         currentTime += Time.deltaTime;
     }
     else
     {
         OnEnd?.Invoke();
         if (_oneTime)
         {
             //Timer ended but is oneTime
             Active      = false;
             currentTime = Mathf.Round(currentTime);
         }
         else
         {
             //Timer ended and reset
             currentTime = 0f;
             Active      = true;
         }
     }
 }
Exemplo n.º 10
0
 protected virtual void RaiseOnEnd()
 {
     OnEnd?.Invoke(this, !taskFailed, exception);
     SetupContinuations();
     hasRun = true;
     UpdateProgress(100, 100);
 }
Exemplo n.º 11
0
        public void CreateAndAppendToActionExceptions(Action <IActionContext> action, Func <Exception, IActionContext, Exception> errorHandlingOverride, [CallerMemberName] string name = null, string contextGroupName = "default")
        {
            if (action == null)
            {
                return;
            }

            using var context = new ActionContext(contextGroupName, name, Settings, Sanitizers);
            context.State.SetParam("RunnerType", this.GetType().Name);

            try
            {
                if (context.Info.IsRoot)
                {
                    OnStart?.Invoke(context);
                }

                action.Invoke(context);

                OnEnd?.Invoke(context);
            }
            catch (Exception ex)
            {
                var handleError = errorHandlingOverride ?? HandleError;
                throw handleError(ex, context);
            }
        }
Exemplo n.º 12
0
        private void OnTalkEnd(Level level)
        {
            Player player = Scene.Tracker.GetEntity <Player>();

            if (player != null)
            {
                player.StateMachine.Locked = false;
                player.StateMachine.State  = 0;
            }
            talkRoutine.Cancel();
            talkRoutine.RemoveSelf();
            Session.IncrementCounter(id + "DialogCounter");
            if (endLevel)
            {
                if (dialogs.Length == 1 || Session.GetCounter(id + "DialogCounter") > dialogs.Length - 1)
                {
                    level.CompleteArea();
                    player.StateMachine.State = Player.StDummy;
                }
            }
            if (onlyOnce)
            {
                if (dialogs.Length == 1 || Session.GetCounter(id + "DialogCounter") > dialogs.Length - 1)
                {
                    Remove(Talker);
                }
            }
            else if (Session.GetCounter(id + "DialogCounter") > dialogs.Length - 1 || dialogs.Length == 1)
            {
                Session.SetCounter(id + "DialogCounter", 0);
            }
            OnEnd?.Invoke();
        }
Exemplo n.º 13
0
        public override void Excute(EventContext context)
        {
            if (this.IsDone)
            {
                return;
            }

            var animation = m_animationCallBack.Invoke(context);

            if (animation)
            {
                if (m_played && !animation.isPlaying)
                {
                    this.IsDone = true;
                    OnEnd?.Invoke(context);
                    return;
                }
                else
                {
                    context.PushToNextFrame(this);
                }
            }
            else
            {
                this.IsDone = true;
                OnEnd?.Invoke(context);
                return;
            }

            m_played = true;
            animation.Play(this.m_animationName, this.m_animationPlayMode);
            context.PushToNextFrame(this);
        }
Exemplo n.º 14
0
 void EndGame()
 {
     if (VisitorOrders.Count(x => x.isActiveAndEnabled) == 0)
     {
         OnEnd?.Invoke();
     }
 }
Exemplo n.º 15
0
            void End()
            {
                Coroutine  = null;
                Operations = null;

                OnEnd?.Invoke();
            }
Exemplo n.º 16
0
        private void Init()
        {
            startupAnime = new Anime();
            startupAnime.AnimateColor((color) => this.Glow.Color = color)
            .AddTime(0f, new Color(1f, 1f, 1f, 0f), EaseType.QuadEaseOut)
            .AddTime(0.1f, new Color(1f, 1f, 1f, 1f), EaseType.QuadEaseIn)
            .AddTime(1f, new Color(0f, 0f, 0f, 1f))
            .Build();
            startupAnime.AnimateColor((color) => this.Outer.Color = color)
            .AddTime(0f, new Color(1f, 1f, 1f, 0f), EaseType.QuadEaseOut)
            .AddTime(0.1f, new Color(1f, 1f, 1f, 1f), EaseType.QuadEaseIn)
            .AddTime(1f, new Color(0.25f, 0.25f, 0.25f, 1f))
            .Build();
            startupAnime.AnimateColor((color) => this.Inner.Color = color)
            .AddTime(0.1f, new Color(1f, 1f, 1f, 0f), EaseType.QuadEaseIn)
            .AddTime(1f, new Color(0.25f, 0.25f, 0.25f, 1f))
            .Build();
            startupAnime.AnimateColor((color) => this.Title.Color = color)
            .AddTime(0.5f, new Color(), EaseType.QuartEaseIn)
            .AddTime(1f, new Color(0.75f, 0.75f, 0.75f, 1f))
            .Build();
            startupAnime.AddEvent(startupAnime.Duration, () => OnStartup?.Invoke());

            breatheAnime          = new Anime();
            breatheAnime.WrapMode = WrapModeType.Loop;
            breatheAnime.AnimateColor((color) => this.Glow.Color = color)
            .AddTime(0f, Color.black, EaseType.SineEaseOut)
            .AddTime(1.1f, Color.gray, EaseType.SineEaseIn)
            .AddTime(2.2f, Color.black)
            .Build();
            breatheAnime.AnimateColor((color) => this.Title.Color = color)
            .AddTime(0f, new Color(0.75f, 0.75f, 0.75f, 1f), EaseType.SineEaseOut)
            .AddTime(1.1f, Color.white, EaseType.SineEaseIn)
            .AddTime(2.2f, new Color(0.75f, 0.75f, 0.75f, 1f))
            .Build();

            endAnime = new Anime();
            endAnime.AnimateColor((color) => this.Glow.Color = color)
            .AddTime(0f, () => this.Glow.Color, EaseType.QuartEaseIn)
            .AddTime(1.5f, Color.white)
            .Build();
            endAnime.AnimateColor((color) => this.Outer.Color = color)
            .AddTime(0f, () => this.Outer.Color, EaseType.QuartEaseIn)
            .AddTime(1.5f, Color.white)
            .Build();
            endAnime.AnimateColor((color) => this.Inner.Color = color)
            .AddTime(0f, () => this.Inner.Color, EaseType.QuartEaseIn)
            .AddTime(1.5f, Color.white)
            .Build();
            endAnime.AnimateColor((color) => this.Title.Color = color)
            .AddTime(0f, () => this.Title.Color, EaseType.QuartEaseIn)
            .AddTime(1.5f, Color.white)
            .Build();
            endAnime.AnimateVector3((scale) => this.Scale = scale)
            .AddTime(0f, Vector3.one, EaseType.SineEaseOut)
            .AddTime(1.5f, new Vector3(1.1f, 1.1f, 1.1f))
            .Build();
            endAnime.AddEvent(endAnime.Duration, () => OnEnd?.Invoke());
        }
Exemplo n.º 17
0
 private void EndGame(bool isWin)
 {
     State = GameState.End;
     Win   = isWin;
     AttachSuccesfullBoxesToShip();
     ((InPanel)Menu.Instance.InGame).ShowScore(0);
     OnEnd.Invoke();
 }
Exemplo n.º 18
0
 public void Stop()
 {
     if (!isPlaying)
     {
         return;
     }
     StopSound(source);
     OnEnd?.Invoke();
 }
Exemplo n.º 19
0
 protected virtual void RaiseOnEnd()
 {
     OnEnd?.Invoke(this);
     if (continuationOnSuccess == null && continuationOnFailure == null && continuationOnAlways == null)
     {
         finallyHandler?.Invoke();
     }
     //Logger.Trace($"Finished {ToString()}");
 }
Exemplo n.º 20
0
    public virtual void OnEventEnd()
    {
        if (EventEnd != null)
        {
            EventEnd.Invoke();
        }

        _signHand.EventStop(this);
    }
Exemplo n.º 21
0
 protected virtual void RaiseOnEnd()
 {
     OnEnd?.Invoke(this);
     if (Task.Status != TaskStatus.Faulted && continuation == null)
     {
         finallyHandler?.Invoke();
     }
     //Logger.Trace($"Finished {ToString()}");
 }
Exemplo n.º 22
0
        public void NewThreadBubbleSort(string[] A, StringComparer comparer)
        {
            Thread thread = new Thread(() =>
            {
                BubbleSort(A, comparer);
                OnEnd?.Invoke($"sorting thread Ends");
            });

            thread.Start();
        }
Exemplo n.º 23
0
        public virtual void Evaluate()
        {
            if (!_condition.Invoke(this))
            {
                return;
            }

            OnComplete?.Invoke();
            OnEnd?.Invoke();
        }
Exemplo n.º 24
0
        private void OnDestroy()
        {
            Controller.Instance?.Input.Gameplay.Disable();

            OnEnd?.Invoke();
            Destroy(player);
            Destroy(gameContainer);
            Destroy(blackOverlay);

            instance = null;
        }
Exemplo n.º 25
0
    public void EndGame()
    {
        stage++;
        anim.SetInteger("lightStage", stage);

        // has functions from Player.cs, EndUI.cs, Enemy.cs, PickupSpawn.cs
        if (stage >= 4)
        {
            OnEnd?.Invoke();
        }
    }
Exemplo n.º 26
0
 public void Choose(Answer answer)
 {
     if (0 <= answer.Target && answer.Target < _dialog.Speeches.Length)
     {
         CurrentSpeech = _dialog.Speeches[answer.Target];
     }
     else
     {
         OnEnd?.Invoke();
     }
 }
Exemplo n.º 27
0
        public void End(bool invoke)
        {
            lock (_lock) {
                Ended = DateTime.UtcNow;

                if (invoke)
                {
                    OnEnd?.Invoke(this);
                }
            }
        }
Exemplo n.º 28
0
        /// <summary>
        ///
        /// </summary>
        public void End()
        {
            working = false;

            if (OnEnd != null)
            {
                OnEnd.Invoke();
            }

            OnEnd = null;
        }
Exemplo n.º 29
0
        public void Update(Transform transform)
        {
            var leftOverHoney = Mathf.Min(_beeHoneyData.AvailableCount, _beeHoneyData.Rate * Time.deltaTime);

            _hive.AddHoney(leftOverHoney);
            _beeHoneyData.AddHoney(-leftOverHoney);

            if (_beeHoneyData.AvailableCount <= 0)
            {
                OnEnd.Invoke();
            }
        }
Exemplo n.º 30
0
        public bool End()
        {
            if (!IsActive)
            {
                return(false);
            }

            IsActive = false;
            EndImpl();
            OnEnd?.Invoke(this, EventArgs.Empty);
            return(true);
        }