public void Pause()
        {
            switch (CurrentState.CurrentPhase)
            {
            case TimerPhase.Running:
                var realTime = CurrentState.CurrentTime.RealTime;
                if (realTime == null)
                {
                    break;
                }
                CurrentState.TimePausedAt = realTime.Value;
                CurrentState.CurrentPhase = TimerPhase.Paused;
                OnPause?.Invoke(this, null);
                break;

            case TimerPhase.Paused:
                CurrentState.AdjustedStartTime = TimeStamp.Now - CurrentState.TimePausedAt;
                CurrentState.CurrentPhase      = TimerPhase.Running;
                OnResume?.Invoke(this, null);
                break;

            case TimerPhase.NotRunning:
                Start();
                break;

            case TimerPhase.Ended:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 2
0
    public void Resume()
    {
        gameObject.SetActive(false);

        // Cursor lock
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        //Invoke playercontroller to resume game
        onResume.Invoke();
    }
Exemplo n.º 3
0
 private MediaRecorder(IJSRuntime jsRuntime, JsObjectRef jsObjectRef, IMediaStream stream,
                       MediaRecorderOptions options) : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListenerForObjectRef("dataavailable", (s, e) => OnDataAvailable?.Invoke(s, e),
                                        BlobEvent.Create);
     AddNativeEventListenerForObjectRef("error", (s, e) => OnError?.Invoke(s, e),
                                        DOMException.Create);
     AddNativeEventListener("pause", (s, e) => OnPause?.Invoke(s, e));
     AddNativeEventListener("resume", (s, e) => OnResume?.Invoke(s, e));
     AddNativeEventListener("start", (s, e) => OnStart?.Invoke(s, e));
     AddNativeEventListener("stop", (s, e) => OnStop?.Invoke(s, e));
 }
Exemplo n.º 4
0
 public void GameResume()
 {
     Paused = false;
     foreach (var component in components.ToArray())
     {
         component.GameResume();
     }
     if (OnResume != null)
     {
         OnResume.Invoke();
     }
 }
Exemplo n.º 5
0
        private void HandleApprovalStateChangedEvent(ApprovalStateChangedEvent evt)
        {
            switch (evt.Entity.CurrentState)
            {
            case Approval.StateEnum.ACTIVE:
                OnResume?.Invoke();
                break;

            case Approval.StateEnum.PAUSED:
                OnPause?.Invoke();
                break;
            }
        }
Exemplo n.º 6
0
        public void InvokeResume()
        {
            if (!IsPaused)
            {
                return;
            }
            if (MusicController.IsPaused)
            {
                MusicController.Play();
            }

            IsPaused = false;
            OnResume?.Invoke();
        }
Exemplo n.º 7
0
        private void HandleApprovalStatusChangedEvent(ApprovalStatusChangedEvent evt)
        {
            switch (evt.Entity.Status)
            {
            case Approval.StatusEnum.APPROVED:
                OnResume?.Invoke();
                break;

            case Approval.StatusEnum.REJECTED:
                OnRevoke?.Invoke();
                socket.CloseConnection();
                break;
            }
        }
Exemplo n.º 8
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit      += (s, e) => OnSplit?.Invoke(this, e);
     model.OnSkipSplit  += (s, e) => OnSkipSplit?.Invoke(this, e);
     model.OnUndoSplit  += (s, e) => OnUndoSplit?.Invoke(this, e);
     model.OnStart      += (s, e) => OnStart?.Invoke(this, e);
     model.OnReset      += (s, e) => OnReset?.Invoke(this, e);
     model.OnPause      += (s, e) => OnPause?.Invoke(this, e);
     model.OnResume     += (s, e) => OnResume?.Invoke(this, e);
     model.OnScrollUp   += (s, e) => OnScrollUp?.Invoke(this, e);
     model.OnScrollDown += (s, e) => OnScrollDown?.Invoke(this, e);
     model.OnSwitchComparisonPrevious += (s, e) => OnSwitchComparisonPrevious?.Invoke(this, e);
     model.OnSwitchComparisonNext     += (s, e) => OnSwitchComparisonNext?.Invoke(this, e);
 }
Exemplo n.º 9
0
    public void StartGame(string _m)
    {
        switch (_m)
        {
        case "Controller":
            if (!WSB_InputManager.I.ChangeControllers(ControlsMode.Controller, isBanController))
            {
                return;
            }
            break;

        case "Keyboard":
            if (!WSB_InputManager.I.ChangeControllers(ControlsMode.Keyboard, isBanController))
            {
                return;
            }
            break;

        case "Both":
            if (!WSB_InputManager.I.ChangeControllers(ControlsMode.ControllerKeyboard, isBanController))
            {
                return;
            }
            break;

        default:
            return;
        }

        // Get all the rigidbody in the scene and unfreeze them
        Rigidbody2D[] _physics = FindObjectsOfType <Rigidbody2D>();
        foreach (Rigidbody2D _r in _physics)
        {
            if (_r.GetComponent <WSB_Player>() || _r.GetComponent <WSB_Movable>() || _r.GetComponent <WSB_MovingPlateform>() || _r.transform.tag == "Earth")
            {
                continue;
            }
            _r.isKinematic = false;
        }

        // Set Pause to false
        Paused = false;



        OnResume?.Invoke();

        //// Hide menu
        //menu.SetActive(false);
    }
Exemplo n.º 10
0
    /// <summary>
    /// Toggle whether the game is paused
    /// </summary>
    public void TogglePause()
    {
        Paused = !paused;

        if (Paused)
        {
            Cursor.visible = true;
            OnPause?.Invoke();
        }
        else
        {
            Cursor.visible = false;
            OnResume?.Invoke();
        }
    }
Exemplo n.º 11
0
 public void Resume()
 {
     if (GameStateManager.instance != false)
     {
         AudioManager.instance.PlayAtRandomPitch("ClickSFX");
         pauseScreen.SetActive(false);
         GameStateManager.instance.ResumeGame();
         if (SettingsMenu.instance.IsVisible())
         {
             SettingsMenu.instance.ToggleSettings(false, false);
         }
         OnResume?.Invoke();
         InitStateManager.currGameMode = GameModes.Powercut;
     }
 }
Exemplo n.º 12
0
    public UIManager(UIComponents _components)
    {
        components = _components;

        components.pauseButton.onClick.AddListener(() =>
        {
            OnPause?.Invoke();
            components.panel.SetActive(true);
        });

        components.resumeButton.onClick.AddListener(() =>
        {
            OnResume?.Invoke();
            components.panel.SetActive(false);
        });
    }
 public void OnButtonClick()
 {
     gamePaused = !gamePaused;
     pausePanel.SetActive(gamePaused);
     if (gamePaused)
     {
         buttonImage.sprite = playSprite;
         buttonColour.color = playColor;
         onPause?.Invoke();
     }
     else
     {
         buttonImage.sprite = pauseSprite;
         buttonColour.color = pauseColor;
         onResume?.Invoke();
     }
 }
Exemplo n.º 14
0
 public void Pause()
 {
     if (CurrentState.CurrentPhase == TimerPhase.Running)
     {
         CurrentState.TimePausedAt = CurrentState.CurrentTime.RealTime.Value;
         CurrentState.CurrentPhase = TimerPhase.Paused;
         OnPause?.Invoke(this, null);
     }
     else if (CurrentState.CurrentPhase == TimerPhase.Paused)
     {
         CurrentState.AdjustedStartTime = TimeStamp.Now - CurrentState.TimePausedAt;
         CurrentState.CurrentPhase      = TimerPhase.Running;
         OnResume?.Invoke(this, null);
     }
     else if (CurrentState.CurrentPhase == TimerPhase.NotRunning)
     {
         Start();  //f**k abahbob
     }
 }
Exemplo n.º 15
0
    private void Update()
    {
        timeSinceOpen += Time.deltaTime;

        if (InputManager.GetInput("Pause") > 0f && !isShifting && canPause)
        {
            if (IsPaused)
            {
                OnResume?.Invoke();
            }
            else
            {
                OnPause?.Invoke();
            }

            isShifting = true;
            shiftingUp = IsPaused;
        }

        if (isShifting)
        {
            float scl = Time.timeScale;
            scl += Time.unscaledDeltaTime / (shiftingUp ? SHIFT_DURATION : -SHIFT_DURATION);
            if (scl <= 0f || scl >= intendedTimeSpeed)
            {
                Time.timeScale = Mathf.Clamp(scl, 0f, intendedTimeSpeed);
                isPaused       = !isPaused;
                isShifting     = false;
            }
            else
            {
                Time.timeScale = scl;
            }
        }

        Time.fixedDeltaTime = IsStopped ? 1f : 0.01666666f / Time.timeScale;
    }
Exemplo n.º 16
0
 public void Resume()
 {
     // Set Pause state to false, invoke resume event, hide pause menu
     Paused = false;
     OnResume?.Invoke();
 }
Exemplo n.º 17
0
 public void Resume()
 {
     GameIsPause = false;
     OnResume.Invoke();
 }
Exemplo n.º 18
0
 public void BroadcastResume()
 {
     OnResume?.Invoke();
 }
Exemplo n.º 19
0
Arquivo: Dialog.cs Projeto: KLD/Hoofa
 /// <summary>
 /// Invoked when dialog resumes after pausing.
 /// </summary>
 public virtual void WhenDialogResume()
 {
     OnResume?.Invoke();
 }
Exemplo n.º 20
0
 private void InvokeResumeActions()
 {
     OnResume?.Invoke();
     SetCurrentStateMachineType(previousStateMachineType);
 }
Exemplo n.º 21
0
 public static void ResumeGame()
 {
     OnResume?.Invoke();
 }
Exemplo n.º 22
0
 public void OnBaseResume(object sender, EventArgs e)
 {
     OnResume?.Invoke(sender, e);
 }
Exemplo n.º 23
0
 public void PressResume()
 {
     OnResume?.Invoke();
 }
Exemplo n.º 24
0
 public void Resume()
 {
     OnResume.Invoke();
 }
Exemplo n.º 25
0
 private void OnOnResume()
 {
     OnResume?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 26
0
 public void Resume(string input)
 {
     OnResume?.Invoke();
     Pause.paused = false;
     SceneManager.LoadScene("Level1");
 }
 public void SendResume()
 {
     OnResume?.Invoke();
 }