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(); } }
public async void RaiseOnEnd() { if (OnEnd != null) { await OnEnd.Invoke(); } }
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; } } }
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)); } }
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; }
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); } }
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); }
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); }
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; } } }
protected virtual void RaiseOnEnd() { OnEnd?.Invoke(this, !taskFailed, exception); SetupContinuations(); hasRun = true; UpdateProgress(100, 100); }
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); } }
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(); }
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); }
void EndGame() { if (VisitorOrders.Count(x => x.isActiveAndEnabled) == 0) { OnEnd?.Invoke(); } }
void End() { Coroutine = null; Operations = null; OnEnd?.Invoke(); }
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()); }
private void EndGame(bool isWin) { State = GameState.End; Win = isWin; AttachSuccesfullBoxesToShip(); ((InPanel)Menu.Instance.InGame).ShowScore(0); OnEnd.Invoke(); }
public void Stop() { if (!isPlaying) { return; } StopSound(source); OnEnd?.Invoke(); }
protected virtual void RaiseOnEnd() { OnEnd?.Invoke(this); if (continuationOnSuccess == null && continuationOnFailure == null && continuationOnAlways == null) { finallyHandler?.Invoke(); } //Logger.Trace($"Finished {ToString()}"); }
public virtual void OnEventEnd() { if (EventEnd != null) { EventEnd.Invoke(); } _signHand.EventStop(this); }
protected virtual void RaiseOnEnd() { OnEnd?.Invoke(this); if (Task.Status != TaskStatus.Faulted && continuation == null) { finallyHandler?.Invoke(); } //Logger.Trace($"Finished {ToString()}"); }
public void NewThreadBubbleSort(string[] A, StringComparer comparer) { Thread thread = new Thread(() => { BubbleSort(A, comparer); OnEnd?.Invoke($"sorting thread Ends"); }); thread.Start(); }
public virtual void Evaluate() { if (!_condition.Invoke(this)) { return; } OnComplete?.Invoke(); OnEnd?.Invoke(); }
private void OnDestroy() { Controller.Instance?.Input.Gameplay.Disable(); OnEnd?.Invoke(); Destroy(player); Destroy(gameContainer); Destroy(blackOverlay); instance = null; }
public void EndGame() { stage++; anim.SetInteger("lightStage", stage); // has functions from Player.cs, EndUI.cs, Enemy.cs, PickupSpawn.cs if (stage >= 4) { OnEnd?.Invoke(); } }
public void Choose(Answer answer) { if (0 <= answer.Target && answer.Target < _dialog.Speeches.Length) { CurrentSpeech = _dialog.Speeches[answer.Target]; } else { OnEnd?.Invoke(); } }
public void End(bool invoke) { lock (_lock) { Ended = DateTime.UtcNow; if (invoke) { OnEnd?.Invoke(this); } } }
/// <summary> /// /// </summary> public void End() { working = false; if (OnEnd != null) { OnEnd.Invoke(); } OnEnd = null; }
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(); } }
public bool End() { if (!IsActive) { return(false); } IsActive = false; EndImpl(); OnEnd?.Invoke(this, EventArgs.Empty); return(true); }