private void onTimeRemainingUpdated() { var data = new TimeRemainingEventArgs { TimeRemaining = this.timeRemaining }; this.TimeRemainingUpdated?.Invoke(this, data); }
private void resetTimeRemainingTimer() { this.timeRemainingTimer.Stop(); this.playerManager.ResetTimeRemaining(); var timeRemaining = new TimeRemainingEventArgs { TimeRemaining = this.playerManager.TimeRemaining }; this.TimeRemainingCount?.Invoke(this, timeRemaining); this.timeRemainingTimer.Start(); }
private void timeRemainingTimerOnTick(object sender, object e) { this.playerManager.DecrementTimeRemaining(); var timeRemaining = new TimeRemainingEventArgs { TimeRemaining = this.playerManager.TimeRemaining }; this.TimeRemainingCount?.Invoke(this, timeRemaining); if (this.playerManager.TimeRemaining == 0) { this.handleTimeRemainingIsZero(); } }
private async void handlePowerUpIsHit(PowerUp powerUp) { this.PowerUpActivated?.Invoke(this, EventArgs.Empty); if (powerUp.PowerUpType == PowerUpType.Timer) { this.playerManager.TimerPowerUp(); powerUp.Sprite.Visibility = Visibility.Collapsed; var timeRemaining = new TimeRemainingEventArgs { TimeRemaining = this.playerManager.TimeRemaining }; this.TimeRemainingCount?.Invoke(this, timeRemaining); } else { this.playerIsImmune = true; powerUp.Sprite.Visibility = Visibility.Collapsed; await Task.Delay(3000); this.playerIsImmune = false; } }