private void BeatContainer_Init() { this.iBeatCounter = Substitute.For <IBeatCounter>(); this.iBeatCounter.BarLength.Returns(4f); this.iBeatCounter.Bpm.Returns(60f); this.iMetronome = Substitute.For <IMetronome>(); this.metronome = new Metronome(4f); }
private void Awake() { if (this.pauseObject == null) { throw new NullReferenceException("Missing Pause object ref"); } this.pause = this.pauseObject.GetComponent <IPause>(); this.pause.RaisePause += Pause_RaisePause; SetObjectPool(); this.uiRhythmController = this.gameObject.GetComponent <UIRhythmController>(); this.audioController = this.gameObject.GetComponent <RhythmAudioController>(); this.inputController = this.gameObject.GetComponent <RhythmInputController>(); this.challengeController = this.gameObject.GetComponent <RhythmChallengeController>(); this.inputController.enabled = false; this.beatCounter = this.gameObject.GetComponent <IBeatCounter>(); if (beatCounter == null) { throw new NullReferenceException("Missing IBeatCounter"); } this.rhythmContainer = new RhythmContainer(this as IRhythmController, this as IRhythmStreak); this.pads = this.rhythmContainer.CreateButtonsWithCurrentLesson(); GetPadControllers(pads); Lesson currentLesson = this.rhythmContainer.CurrentLesson; Rhythm rhythm = currentLesson.rhythm; SetUI(rhythm.IntroText, rhythm.bpmChallenge); foreach (IPadController pad in pads) { pad.SetBPM(rhythm.bpmChallenge); } this.streakContainer = new StreakContainer(); this.uiRhythmController.SetStreakText(this.streakContainer.StreakCount.ToString()); this.uiRhythmController.SetStyleNameText(currentLesson.name); this.beatCounter.Init(currentLesson.rhythm.bar); this.beatCounter.SetBeatCounterRunning(false); this.beatCounter.SetBpm(rhythm.bpmChallenge); this.challengeController.InitWithChallenges(rhythm.streakChallenge, rhythm.bpmChallenge); }