void PauseGame() { if (Input.GetButtonDown("Pause")) { pauseEvent.Invoke(); } }
private void Pause() { _timeScalePrePause = Time.timeScale; _gameStopped = true; Time.timeScale = 0; PauseEvent?.Invoke(); }
public void OnPause(InputAction.CallbackContext context) { if (context.phase == InputActionPhase.Performed) { PauseEvent.Invoke(); } }
public void Pause() { _timeScale = 0; if (OnPause != null) { OnPause.Invoke(true); } }
public void UnPause() { _timeScale = 1; if (OnUnpause != null) { OnUnpause.Invoke(false); } }
public void TogglePause() { _isPaused = !_isPaused; UIManager.Instance.EnablePauseUI(IsPaused); PauseEvent?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Handles showing and hiding UI elements /// /// Also re-creates the pause event for future use /// </summary> void Pause() { restart.gameObject.SetActive(paused); pause.gameObject.SetActive(paused); play.gameObject.SetActive(!paused); timeBar.gameObject.SetActive(!paused); paused = !paused; pauseEvent.Invoke(); pauseEvent = new PauseEvent(); EventManager.AddPauseTimeInvoker(this); }
public void Resume() { if (isPaused) { onResume.Invoke(); Time.timeScale = lastTimeScale; Time.fixedDeltaTime = fixedDeltaTime * lastTimeScale; } realPause = false; isPaused = false; pausePanel.gameObject.SetActive(false); }
private void Pause(bool state) { paused = state; if (paused) { Time.timeScale = 0; } else { Time.timeScale = 1; } PauseEvent?.Invoke(state); }
public void Pause() { if (!isPaused) { onPaused.Invoke(); lastTimeScale = Time.timeScale; Time.timeScale = 0; Time.fixedDeltaTime = 0; } realPause = true; isPaused = true; pausePanel.gameObject.SetActive(true); }
public void Pause() { _isPaused = true; Time.timeScale = 0f; PauseEvent?.Invoke(); _UIElements.RemoveAll(x => x.activeSelf == false); foreach (var element in _UIElements) { element.SetActive(false); } _pauseMenuUI.SetActive(true); _background.SetActive(true); }
// Update is called once per frame void Update() { if (!paused && pauseButton.GetState(controller) && canPause) { t += Time.deltaTime; if (t > pauseDelay) { OnPause?.Invoke(); paused = true; LevelSaveManager.currentInstance.SaveGame(); SceneManager.LoadScene(scene); t = 0; } } }
/// <summary> /// 暂停按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pause_Click(object sender, EventArgs e) { if (running) //运行中 { if (pausing) //暂停中 { return; } else { PauseEvent?.Invoke(); pausing = true; pause.Enabled = false; } } else { return; } }
public void HandleGenericEvent(string p_eventname) { switch (p_eventname) { case "PAUSE": GameState.PauseGame(); PauseEvent?.Invoke(); break; case "UNPAUSE": GameState.UnpauseGame(); UnPauseEvent?.Invoke(); break; default: break; } //Set time scale Time.timeScale = GameState.TimeScale; }
void HandleMessage(string msg, dynamic args, Request request) { LogDebug("(in) " + request.type + " " + msg); LogVerbose("... " + JsonConvert.SerializeObject(request)); args = args ?? new { }; try { switch (msg) { case "initialize": var cap = new Capabilities(); InitializeEvent?.Invoke(request, cap); Send(request, cap); Initialized(); break; case "configurationDone": ConfigurationDoneEvent?.Invoke(request); break; case "launch": LaunchEvent?.Invoke(request, JsonConvert.SerializeObject(args)); break; case "attach": AttachEvent?.Invoke(request, JsonConvert.SerializeObject(args)); break; case "disconnect": DisconnectEvent?.Invoke(request); break; case "next": StepOverEvent?.Invoke(request); break; case "continue": ContinueEvent?.Invoke(request); break; case "stepIn": StepInEvent?.Invoke(request); break; case "stepOut": StepOutEvent?.Invoke(request); break; case "pause": PauseEvent?.Invoke(request); break; case "threads": GetThreadsEvent?.Invoke(request); break; case "scopes": GetScopesEvent?.Invoke(request, (int)args.frameId); break; case "stackTrace": GetStackTraceEvent?.Invoke(request); break; case "variables": _tempVariables.Clear(); GetVariablesEvent?.Invoke(request, (int)args.variablesReference, _tempVariables); Send(request, new VariablesResponseBody(_tempVariables)); break; case "setVariable": var variable = new Variable((string)args.name, (string)args.value, "", (int)args.variablesReference); SetVariableEvent?.Invoke( request, variable ); Send( request, new SetVariableResponseBody(variable.value, variable.variablesReference) ); break; case "loadedSources": GetLoadedSourcesEvent?.Invoke(request); break; case "source": GetSourceEvent?.Invoke(request); break; case "evaluate": string resultEval = ""; EvaluateEvent?.Invoke( request, (int)args.frameId, (string)args.context, (string)args.expression, (bool)(args.format?.hex ?? false), ref resultEval ); Send( request, new EvaluateResponseBody( resultEval ) ); break; case "completions": GetCompletionsEvent?.Invoke( request, (int)args.frameId, (int)args.line, (int)args.column, (string )args.text ); break; case "setBreakpoints": SetBreakpointsEvent?.Invoke(request); break; // case "runInTerminal": // OnRunInTerminal?.Invoke( pRequest ); // break; // case "setFunctionBreakpoints": // SetFunctionBreakpoints( pResponse, pArgs ); // break; // case "setExceptionBreakpoints": // SetExceptionBreakpoints( pResponse, pArgs ); // break; default: CustomRequestEvent?.Invoke(request); if (!request.responded) { Log( Logging.Severity.Error, string.Format("Request not handled: '{0}' [{1}]", msg, Convert.Encode(request.arguments.ToString())) ); } break; } } catch (Exception e) { Log( Logging.Severity.Error, $"Error during request '{Convert.Encode( request.arguments.ToString() )}' [{msg}] (exception: {e.Message})\n{e}" ); Send(new Response(request, errorMsg: e.Message)); } }
/// <summary> /// Pause. /// </summary> public void Pause() { _isPlaying = false; _onPauseEvent.Invoke(); }
public static void Pause() { PauseEvent?.Invoke(); GameData.CurrentScreen = GameData.Screens.PauseScreen; }
public void Pause() { PauseEvent?.Invoke(); }
public void TogglePause() { _isPaused = !_isPaused; PauseEvent?.Invoke(this, EventArgs.Empty); }