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 override void Update() { foreach (var t in _times.Keys.ToList()) { _times[t] -= Time.deltaTime; } foreach (var t in animated) { t.Translate(_directions[t] * Time.deltaTime * _speed); } animated.RemoveWhere((x) => { if (_times[x] <= 0) { _directions.Remove(x); _times.Remove(x); OnEnd[x]?.Invoke(x); OnEnd.Remove(x); return(true); } else { return(false); } }); }
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); } }
IEnumerator Init(OnEnd onReady) { string DataFilePath = App.BasePath + App.GetManifestPath(App.AppId); App.Downloader = App.DataObject.AddComponent <Downloader>(); App.Downloader.Initialize(); DontDestroyOnLoad(App.DataObject); if (File.Exists(DataFilePath)) { File.Delete(DataFilePath); } App.Downloader.DownloadManifest(App.AppId, new OnEnd(OnJsonDownloaded)); while (!GotJson) { yield return(null); } AppData appData = (AppData)App.DataObject.AddComponent <AppData>(); Debug.Log("GotJson"); App.Data = appData; }
public UncollectHiveAction(Hive hive, BeeHoneyData beeHoneyData, UnityAction onEnd, UnityAction onCancel) { _hive = hive; _beeHoneyData = beeHoneyData; OnEnd.AddListener(onEnd); OnCancel.AddListener(onCancel); }
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(); }
void EndGame() { if (VisitorOrders.Count(x => x.isActiveAndEnabled) == 0) { OnEnd?.Invoke(); } }
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 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 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); } }
protected virtual void RaiseOnEnd() { OnEnd?.Invoke(this, !taskFailed, exception); SetupContinuations(); hasRun = true; UpdateProgress(100, 100); }
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; } } }
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; }
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); }
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; } } }
void End() { Coroutine = null; Operations = null; OnEnd?.Invoke(); }
public async void RaiseOnEnd() { if (OnEnd != null) { await 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); }
public CollectFlowerAction(Flower flower, BeeHoneyData beeHoneyData, UnityAction onEnd, UnityAction onCancel) { _flower = flower; _beeHoneyData = beeHoneyData; OnEnd.AddListener(onEnd); OnCancel.AddListener(onCancel); }
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()); }
public PackClientSide(Socket clientSocket, IPEndPoint remoteEndPoint) : base(clientSocket, remoteEndPoint) { m_onData = new OnData(OnDataReceived); m_onMsgRead4Tx = new OnMessageReadyToTx(OnMsgRead4Tx); m_onEnd = new OnEnd(OnTransationEnd); m_receiverPackLib = new ReceiverPackLib.ReceiverPackLib(m_Id, m_onData, m_onEnd, null, m_onMsgRead4Tx); }
public PackClientSide(Socket clientSocket, IPEndPoint remoteEndPoint) : base(clientSocket, remoteEndPoint) { m_onData = new OnData(OnDataReceived); m_onMsgRead4Tx = new OnMessageReadyToTx(OnMsgRead4Tx); m_onEnd = new OnEnd(OnTransationEnd); m_receiverPackLib = new ReceiverPackLib.ReceiverPackLib(m_Id,m_onData, m_onEnd, null, m_onMsgRead4Tx); }
private void EndGame(bool isWin) { State = GameState.End; Win = isWin; AttachSuccesfullBoxesToShip(); ((InPanel)Menu.Instance.InGame).ShowScore(0); OnEnd.Invoke(); }
protected virtual void RaiseOnEnd() { OnEnd?.Invoke(this); if (continuationOnSuccess == null && continuationOnFailure == null && continuationOnAlways == null) { finallyHandler?.Invoke(); } //Logger.Trace($"Finished {ToString()}"); }
public void Stop() { if (!isPlaying) { return; } StopSound(source); OnEnd?.Invoke(); }
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(); }
public ReceiverPackLib(ChunkChainDataTypes.OnData onData, OnEnd onEnd, object onEndParam, OnMessageReadyToTx onMsgReadyToTx) : base(onMsgReadyToTx) { m_Id = new IPEndPoint(0, 0); OnMessageReceived onDataMsg = new OnMessageReceived(ProcessDataMsg); OnMessageReceived onPredAckMsg = new OnMessageReceived(ProcessPredAckMsg); base.SetCallback((int)PackMsg.PackMsg.MsgKind_e.PACK_DATA_MSG_KIND, onDataMsg); base.SetCallback((int)PackMsg.PackMsg.MsgKind_e.PACK_FINALLY_PROCESSED_DATA_MSG_KIND, onDataMsg); base.SetCallback((int)PackMsg.PackMsg.MsgKind_e.PACK_PRED_ACK_MSG_KIND, onPredAckMsg); InitInstance(onData, onEnd, onEndParam); }
public void EndGame() { stage++; anim.SetInteger("lightStage", stage); // has functions from Player.cs, EndUI.cs, Enemy.cs, PickupSpawn.cs if (stage >= 4) { OnEnd?.Invoke(); } }
/// <summary> /// /// </summary> public void End() { working = false; if (OnEnd != null) { OnEnd.Invoke(); } OnEnd = null; }
void DoTest(object arg) { string fileName = (string)arg; UpdateControls updateControls = new UpdateControls(Update_Controls); if (File.Exists("received_file")) { File.Delete("received_file"); } FileStream fs = File.OpenRead(fileName); if (fs == null) { return; } byte[] raw_file = new byte[fs.Length]; if (fs.Read(raw_file, 0, raw_file.Length) != raw_file.Length) { return; } fs.Close(); fs = null; DateTime initialStamp,finishStamp; bool firstIteration = true; ulong ticks_sum = 0; ulong iterations = 0; byte[] buf; OnData onData = new OnData(OnDataReceived); OnEnd onEnd = new OnEnd(OnTransactionEnd); do { initialStamp = DateTime.Now; buf = raw_file; if (File.Exists("received_file")) { File.Delete("received_file"); } ReceiverPackLib.ReceiverPackLib receiverPackLib = new ReceiverPackLib.ReceiverPackLib(onData,onEnd,null); SenderPackLib.SenderPackLib senderPackLib = new SenderPackLib.SenderPackLib(buf); senderPackLib.AddData(buf,false); #if false senderPackLib.AddLast(); bool SameChunk; while ((buf = senderPackLib.GetChunk(out SameChunk)) != null) { byte[] predMsg = receiverPackLib.ReceiverOnData(buf,0); if (predMsg != null) { byte[] predAckMsg = senderPackLib.SenderOnData(predMsg, 0); receiverPackLib.ReceiverOnData(predAckMsg, 0); } } #endif finishStamp = DateTime.Now; object[] args = new object[4]; args[0] = firstIteration; if (firstIteration) { args[1] = (ulong)(finishStamp.Ticks - initialStamp.Ticks); firstIteration = false; } else { ticks_sum += (ulong)(finishStamp.Ticks - initialStamp.Ticks); iterations++; args[1] = ticks_sum / iterations; } args[2] = (ulong)iterations; args[3] = true; Invoke(updateControls, args); while (checkBoxPause.Checked) { Thread.Sleep(1000); } } while (checkBoxDoUntilStopped.Checked); }