protected override void OnHandleDestroyed(EventArgs e) { _model.OnPaused -= OnPaused; _model.OnStarted -= OnStarted; _model = null; if (OnStateSwitched != null) { foreach (var d in OnStateSwitched.GetInvocationList()) { OnStateSwitched -= (Action)d; } } base.OnHandleDestroyed(e); }
protected void SwitchState(BaseGameState gameState) { OnStateSwitched?.Invoke(this, gameState); }
private void State_Button_Click(object sender, EventArgs e) { _model.SwitchState(); OnStateSwitched?.Invoke(); }