private void Attacking(object sender, EventArgs e) { nextButton.Enabled = true; ResetStateHighlight(State); // committing phase if (State > GameState.Attacking) { OnReset?.Invoke(GameState.Committing); } State = GameState.Attacking; // highlight HighlightCorrectButton(State); // propagate into outer form OnAttacking?.Invoke(); }
private void InvokeStateEvent(GameState state) { switch (state) { case GameState.Deploying: OnDeploying?.Invoke(); break; case GameState.Attacking: OnAttacking?.Invoke(); break; case GameState.Committing: OnCommitting?.Invoke(); break; case GameState.Committed: OnCommitted?.Invoke(); break; default: throw new ArgumentOutOfRangeException(nameof(state), state, null); } }