public void StateChanged(IMachineStateComponent <RoundState> component, RoundState previous) { //if (!(sender is IRound round)) return; var round = component; Enabled = round.State.Equals(RoundState.WaitingForBallServe); }
public void StateChanged(IMachineStateComponent <MatchState> sender, MatchState previousState) { if (!(sender is IMatch match)) { return; } if (match.State == MatchState.InstanciatedRound) { Enabled = true; match.CurrentRound.StateChanges += StateChanged; } else if (match.State == MatchState.FindingFirstServer) { Visible = true; TheBall.Visible = true; currentTeam = (new Random().Next(2) == 1) ? Team.Blue : Team.Red; timerSwitcharooDo.Reset(true); timerEndSwitcharoo.IntervalMs = TimeSpan.FromMilliseconds(new Random().Next(2000, 3001)).TotalMilliseconds; timerEndSwitcharoo.Reset(true); timerEndScaling.Reset(false); } else if (previousState == MatchState.FindingFirstServer) { match.CurrentRound.StateChanges -= StateChanged; } }
public void StateChanged(IMachineStateComponent <RoundState> round, RoundState previousState) { if (round.State != RoundState.NotStarted) { Enabled = false; Visible = false; } }
private void Match_MatchStateChanges(IMachineStateComponent <MatchState> component, MatchState previous) { if (!(component is IMatch match)) { return; } Enabled = Visible = match.State.Equals(MatchState.NotStarted); }
public void StateChanged(IMachineStateComponent <MatchState> component, MatchState previousState) { if (!(component is Match match)) { return; } Visible = match.State.Any(MatchState.FindingFirstServer, MatchState.InProgress); }
public void StateChanged(IMachineStateComponent <MatchState> component, MatchState previousState) { if (!(component is IMatch match)) { return; } if (match.State == MatchState.InstanciatedRound) { match.CurrentRound.StateChanges += StateChanged; } }
/// <summary> /// ROUND EVENTS /// </summary> public void StateChanged(IMachineStateComponent <RoundState> component, RoundState previous) { if (_round.State.Equals(RoundState.WaitingForBallServe)) { Paddle servingPaddle = Components.OfType <Paddle>().Where((x) => x.Team == _round.ServingTeam).Single(); ServeBallHandler.AssignRequiredEntities(Ball, servingPaddle); } else if (previous.Equals(RoundState.WaitingForBallServe)) { ServeBallHandler.FreeRequiredEntities(); } }
private void OnMatchStateChanges(IMachineStateComponent<MatchState> component, MatchState previous) { if (!(component is IMatch match)) return; //_moving = (e.Modified.Any(MatchState.InProgress, MatchState.DemoMode)); if (match.State == MatchState.FindingFirstServer) { match.CurrentRound.StateChanges += OnRoundStateChanges; } }
/// <summary> /// MATCH EVENTS /// </summary> public void StateChanged(IMachineStateComponent <MatchState> component, MatchState previous) { if (_match.State == MatchState.InstanciatedRound) { _match.CurrentRound.StateChanges += StateChanged; foreach (IRoundStateSensitive roundSensitive in Components.OfType <IRoundStateSensitive>()) { _round.StateChanges += roundSensitive.StateChanged; } } else if (_match.State == MatchState.FindingFirstServer) { MediaPlayer.Volume = 0.5f; MediaPlayer.Play(music); } }
private void OnRoundStateChanges(IMachineStateComponent<RoundState> component, RoundState e) { if (!(component is IRound round)) return; if (round.State == RoundState.NotStarted) { Enabled = false; Visible = false; } else if (round.State == RoundState.WaitingForBallServe) { Visible = true; Enabled = true; } }
public void StateChanged(IMachineStateComponent <RoundState> component, RoundState previousState) { if (!(component is IRound round)) { return; } Visible = !round.State.Equals(RoundState.NotStarted); Enabled = round.State.Equals(RoundState.InProgress); if (round.State.Equals(RoundState.WaitingForBallServe)) { Transform.Scale = 1f; Visible = true; } }
public void StateChanged(IMachineStateComponent <MatchState> match, MatchState previousState) { Enabled = (!match.State.Any(STATES_WHEN_DISABLED)); }