/// <summary> /// Timer handler to manage ball state, lights, sound, etc. /// </summary> /// <param name="state"></param> private void collectBonusTimerHandler(object state) { //this is called every second. //check if we've collected already(race condition with switches) if (_isBonusCollected || _isBonusFailed) { //do we turn off the timer or just let it dispose? return; } //check how much time is remaining long timeleft = BONUSCOLLECTTIMEOUTMS - _timeStarted.ElapsedMilliseconds; //if > 10 seconds, do nothing if (timeleft > 10000) { return; } else if (timeleft > 9050) //leave some jitter time (or just put in a _soundPlayed flag?) { //if = 10 seconds, start panic song and lighting SoundManager.PlaySfx(SoundConstants.Sfx.HurryUp); LightManager.PlaySequence(LightingConstants.Lfx.CollectTrophyFast); } else if (timeleft <= 0 && !_isBonusFailed) { endPlayTimeout(); } }
/// <summary> /// Adds a player to the player count. /// </summary> internal void AddPlayer() { if (PlayerStatus.CurrentPlayer == null || PlayerStatus.CurrentPlayer.NumPlayers < 4) { PlayerStatus.AddPlayer(); SoundManager.PlaySfx(SoundConstants.Sfx.Start); } }
} //not used /// <summary> /// The player has lost his ball (there are no more balls on the /// playfield). /// </summary> public void EndOfBall() { _log.Debug("End of Ball for Player " + PlayerStatus.PlayerUp); SwitchManager.EnableFlippers(false); _inputMode = InputMode.NoInput; SoundManager.StopAllMusic(); SoundManager.PlaySfx(SoundConstants.Sfx.Death1); CollectBonus(); }
private void handleScoreChanged(int points, SoundConstants.Sfx sound, LightingConstants.Lfx lightEffect) { if (points > 0) { GameManager.getInstance().AddScore(points); } if (sound != SoundConstants.Sfx.None) { SoundManager.PlaySfx(sound); } if (lightEffect != LightingConstants.Lfx.None) { LightManager.PlaySequence(lightEffect); } }
/// <summary> /// Adds a credit /// </summary> internal void AddCredit() { SoundManager.PlaySfx(SoundConstants.Sfx.Credit); }