//static private int rhythmCoreConstructorCount = 0; //public RhythmCore() //{ // rhythmCoreConstructorCount++; // Debug.Log("Created a RhythmCore - current count: " + rhythmCoreConstructorCount); //} //private void OnDestroy() //{ // rhythmCoreConstructorCount--; // Debug.Log("Destroyed a RhythmCore - current count: " + rhythmCoreConstructorCount); //} // Use this for initialization void Start() { // Initialize the beat generation strategy, either with one provided // by another component in this object, or with a hard-coded default ABeatGenerationComponent overridingGenComponent = this.GetComponent <ABeatGenerationComponent>(); if (overridingGenComponent != null) { this.beatGenStrat = overridingGenComponent.GetStrategy(); } else { this.beatGenStrat = new RandArrowNoRepeatStrat(); } // Adjust the beat window if it exceeds the time between beats this.beatWindowDuration = Mathf.Min(this.beatWindowDuration, this.SecondsPerLine()); // Get IRhythmPromptListener components from objects in this.promptListenerObjects this.CompontsOfTypeFromObjects <IRhythmPromptListener>(this.promptListenerObjects, this.promptListeners); // Get IRhythmFeedbackListener components from objects in this.feedbackListenerObjects this.CompontsOfTypeFromObjects <IRhythmFeedbackListener>(this.feedbackListenerObjects, this.feedbackListeners); this.Invoke("OnBeat", this.SecondsPerLine()); }
void Awake() { // Update() should not be called on this component this.enabled = false; // check that a valid coordinator GameObject has been specified if (this.coordinatorObject != null) { // get and check that the given coordinator GameObject has the proper coordinator component script MutexArrowCoordinator coordinatorComponent = this.coordinatorObject.GetComponent <MutexArrowCoordinator>(); if (coordinatorComponent != null) { // handle the selected generator ID switch (this.generatorID) { case CoordinatedGeneratorID.GENERATOR_A: { this._myGenerationStrategy = new MutexArrowNoRepeatStrat_A(ref coordinatorComponent); } break; case CoordinatedGeneratorID.GENERATOR_B: { this._myGenerationStrategy = new MutexArrowNoRepeatStrat_B(ref coordinatorComponent); } break; case CoordinatedGeneratorID.UNSET: { Debug.LogError("MutexArrowNoRepeatComponent ID left unset - please ensure either A or B are selected as ID"); } break; default: { Debug.LogError("Unexpected value for generatorID field of MutexArrowNoRepeatComponent"); } break; } } else { Debug.LogError("Specified GameObject has no MutexArrowCoordinator component - please select a valid coordinator GameObject in the scene"); } } else { Debug.LogError("No coordinator GameObject selected in MutexArrowNoRepeatComponent - please select a coordinator GameObject in the scene"); } }