// played after shooting public void PlayClip(int i) { narrator.PlayNewClip(audioClips[i], gameObject.GetInstanceID(), (IDestroyAudioEvent)this); myState = EAudioState.isPlaying; startTime = Time.time; audioClipIndex++; }
private IEnumerator TriggerAfter() { yield return new WaitForSeconds(delayTime); myState = EAudioState.isPlaying; startTime = Time.time; narrator.PlayNewClip(audioClip[audioClipIndex], gameObject.GetInstanceID(), (IDestroyAudioEvent)this); }
private void Update() { if(myState == EAudioState.isWaiting || myState == EAudioState.isFinished || triggerEvent == false) return; if(myState == EAudioState.isPaused) { if( Time.time > (startTime + waitTimeBetweenClips)) { if( ++audioClipIndex == audioClip.Length ) { myState = EAudioState.isFinished; triggerEvent = false; return; } else { myState = EAudioState.isPlaying; startTime = Time.time; narrator.PlayNewClip(audioClip[audioClipIndex], gameObject.GetInstanceID(), (IDestroyAudioEvent)this); return; } }// If Timer Hasnt Finished Then Wait } if(myState == EAudioState.isPlaying) { if(Time.time < (startTime + audioClip[audioClipIndex].length)) { // Figure out a button to skip (select/back maybe?) if( inputHandler.isSkip ) { narrator.Stop(); startTime = Time.time + 0.25f; myState = EAudioState.isPaused; return; } } if(Time.time > (startTime + audioClip[audioClipIndex].length)) { startTime = Time.time; myState = EAudioState.isPaused; } } }
private void OnTriggerEnter(Collider obj) { if(obj.gameObject.CompareTag("Player") && myState == EAudioState.isWaiting ) { if(hasDelay) { StartCoroutine(TriggerAfter()); } else { myState = EAudioState.isPlaying; startTime = Time.time; narrator.PlayNewClip(audioClip[audioClipIndex], gameObject.GetInstanceID(), (IDestroyAudioEvent)this); } } }
static public void SetAudioState(EAudioState state = EAudioState.Off) { audioState = state; }
private void Update() { if( myState == EAudioState.isPlaying && Time.time > (startTime + clip.length) ) myState = EAudioState.isPaused; }
private void Update() { if(activePower.CurrentPower != ActivePower.Logio) { activePower.CurrentPower = ActivePower.Logio; } waitAtStart -= Time.deltaTime; if (waitAtStart <= 0 && !triggered) { narrator = NarratorController.NarratorInstance; narrator.PlayNewClip(audioClips[audioClipIndex], gameObject.GetInstanceID(), (IDestroyAudioEvent)this); myState = EAudioState.isPlaying; startTime = Time.time; triggered = true; } if(myState == EAudioState.isWaiting) return; if(myState == EAudioState.isFinished) { if( NarratorController.NarratorInstance.isPlaying() ) myState = EAudioState.isPlaying; if( !colliderToTrigger.isTrigger ) { colliderToTrigger.isTrigger = true; } return; } if(myState == EAudioState.isPaused) { if( Time.time > (startTime + waitTimeBetweenClips)) { if(audioClipIndex == 2) return; if(audioClipIndex == 3) // Out Of Cutscene Bounds { myState = EAudioState.isFinished; trigger.GetComponent<BoxCollider>().isTrigger = true; //Destroy(this); } if(audioClipIndex == 1) { playerInputManager.ControllerConstraints = EControlConstraints.EnableAllExceptPowers; narrator.PlayNewClip(audioClips[audioClipIndex], gameObject.GetInstanceID(), (IDestroyAudioEvent)this); myState = EAudioState.isPlaying; } startTime = Time.time; }// If Timer Hasnt Finished Then Wait } if(myState == EAudioState.isPlaying) { // If narrator hasnt finished return if(audioClipIndex == audioClips.Length && !NarratorController.NarratorInstance.isPlaying()) { myState = EAudioState.isFinished; return; } // Evade NullReferenceExceptions if(audioClipIndex == audioClips.Length) return; if(Time.time < (startTime + audioClips[audioClipIndex].length)) { // Figure out a button to skip (select/back maybe?) if( inputHandler.isSkip ) { narrator.Stop(); startTime = Time.time + 0.25f; myState = EAudioState.isPaused; audioClipIndex++; return; } } if(Time.time > (startTime + audioClips[audioClipIndex].length)) { startTime = Time.time; myState = EAudioState.isPaused; audioClipIndex++; } } }