private void PlaySound(BaseEventInfo e) { SoundEventInfo eventInfo = e as SoundEventInfo; if (eventInfo != null) { if (eventInfo.AudioSourceID == 1) { float volume = 0f; if (eventInfo.Volume > 0) { volume = eventInfo.Volume; } else { volume = primaryAudioSourceVolume; } primaryAudioSource.PlayOneShot(eventInfo.SoundClip, volume); } else if (eventInfo.AudioSourceID == 2) { float volume = 0f; if (eventInfo.Volume > 0) { volume = eventInfo.Volume; } else { volume = secondaryAudioSourceVolume; } secondaryAudioSource.PlayOneShot(eventInfo.SoundClip, volume); } } }
public void EndMinigame() { EndMinigameMechanics(); StopAllCoroutines(); ToggleActive(false); SoundEventInfo sei = new SoundEventInfo(applauseSound, applauseSoundVolume, 2); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); if (gameType == GameType.PointsBased || gameType == GameType.PointsAndLives) { StartCoroutine("DisplayPlayerScores"); } else if (gameType == GameType.Finale) { var playerPoints = new Dictionary <Player, int>(); foreach (var item in MinigamePointSystem.GetCurrentScore()) { playerPoints.Add(item.Key, (int)(item.Value * ImportManager.Instance.Settings.FinaleScoreMultiplier)); } MinigamePointSystem.UpdateScore(playerPoints); ShowStandingsUI(); StartCoroutine("GoToNextScene", endOfMatchDelay); } else { ShowStandingsUI(); StartCoroutine("GoToNextScene", endOfMatchDelay); } }
public void PlayHitSound() { if (playerGotHitSound != null) { SoundEventInfo sei = new SoundEventInfo(playerGotHitSound, playerGotHitSoundVolume, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); } }
private void NextCharge() { onWaitUntilNext -= NextCharge; SoundEventInfo sei = new SoundEventInfo(chickenHitWall, chickenHitWallVolume, 2); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); StartCoroutine("WaitUntilNextCharge"); }
private void HandleSoundEvent(SoundEventInfo info) { //Handle sound events here. Action performed based on SoundEventType switch (info.soundEventType) { case SoundEventType.PlaySfx: if (isPaused && info.category == SoundCategory.Gameplay) { return; } PlaySoundEffect(info.sfxType, info.soundLocation); break; case SoundEventType.PlayNextMusic: PlayNextMusic(); break; case SoundEventType.IncreaseVolume: AddToVolume(info.soundVolumeType, volumeStep); break; case SoundEventType.DecreaseVolume: AddToVolume(info.soundVolumeType, -volumeStep); break; case SoundEventType.ToggleMute: ToggleMuteVolume(info.soundVolumeType); break; case SoundEventType.PauseMusic: SetMusicPlaybackState(SoundState.Paused); break; case SoundEventType.ResumeMusic: SetMusicPlaybackState(SoundState.Playing); break; case SoundEventType.ToggleMusicPlayback: ToggleMusicPlaybackState(); break; case SoundEventType.SetListener: SetListenerTransform(info.listenerTransform); break; case SoundEventType.PauseAll: SetMusicPlaybackState(SoundState.Paused); SetSfxPlaybackState(SoundState.Paused); break; case SoundEventType.ResumeAll: SetMusicPlaybackState(SoundState.Playing); SetSfxPlaybackState(SoundState.Playing); break; } }
IEnumerator ShowEndScore() { yield return(new WaitForSeconds(4)); Instantiate(showStandingsUI, canvas.transform); SoundEventInfo sei = new SoundEventInfo(clapSound, clapVolume, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); StartCoroutine("GoToMainMenu"); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { TransformEventInfo tei = new TransformEventInfo(other.gameObject.transform.position, waterSplashEffect.transform.rotation, waterSplashEffect); EventHandler.Instance.FireEvent(EventHandler.EventType.ParticleEvent, tei); SoundEventInfo sei = new SoundEventInfo(waterSplash, waterSplashVolume, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); } }
private void FirePickUpEvent(GameObject player) { TransformEventInfo tei = new TransformEventInfo(player.transform.position, Quaternion.identity, pickUpEffects[GameController.Instance.FindPlayerByGameObject(player).ID]); EventHandler.Instance.FireEvent(EventHandler.EventType.ParticleEvent, tei); SoundEventInfo sei = new SoundEventInfo(pickUpSound, 0.4f, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); PickUpEventInfo pei = new PickUpEventInfo(gameObject, player); EventHandler.Instance.FireEvent(EventHandler.EventType.PickUpEvent, pei); }
IEnumerator SymbolGameLoop() { AssignCurrentSymbol(); AssignPlatformSymbols(); SoundEventInfo sei = new SoundEventInfo(newPlatformSound, newPlatformSoundVolume, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); yield return(new WaitForSeconds(timeToFall)); CheckPlatforms(); timeToFall *= timeToFallMultiplier; StartCoroutine("ResetGame"); }
IEnumerator StartCountDown() { countDownAnim.SetBool("IsCountingDown", true); SoundEventInfo sei = new SoundEventInfo(countDownSound, 0, 2); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); if (miniGameUI != null) { Instantiate(miniGameUI, canvas.transform); } yield return(new WaitForSeconds(countDownTimer)); ToggleActive(true); StartMinigameTimer(); StartMinigameMechanics(); }
private void UseSecondaryAudioSource(SoundEventInfo eventInfo) { if (eventInfo.Volume > 0) { secondaryAudioSource.volume = eventInfo.Volume; } else { secondaryAudioSource.volume = secondaryAudioSourceVolume; } if (eventInfo.SoundClip != null) { secondaryAudioSource.clip = eventInfo.SoundClip; secondaryAudioSource.Play(); } }
//private void PlaySound(SoundEventInfo e) //{ // SoundEventInfo sei = e as SoundEventInfo; // GameObject instance = Instantiate(source); // AudioSource audio = instance.GetComponent<AudioSource>(); // audio.PlayOneShot(sei.SoundClip); // Destroy(instance, sei.SoundClip.length); //} private void UsePrimaryAudioSource(SoundEventInfo eventInfo) { if (eventInfo.Volume > 0) { primaryAudioSource.volume = eventInfo.Volume; } else { primaryAudioSource.volume = primaryAudioSourceVolume; } if (eventInfo.SoundClip != null) { primaryAudioSource.clip = eventInfo.SoundClip; primaryAudioSource.Play(); } }
private void PlayShiftSound() { SoundEventInfo sei = new SoundEventInfo(shiftItemSound, 0, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); }
private void PlayWinnerSound() { SoundEventInfo sei = new SoundEventInfo(winnerSound, 0, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); }
public void PlaySelectionSound() { SoundEventInfo sei = new SoundEventInfo(buttonSelectedSound, 0, 1); EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei); }