public void PlayByName(string clipName, bool loop, Action acion = null) { AudioClip clip = FindAudioClip(clipName); _cas.Play(_source, clip, null, 1, 1, loop, acion); Debug.Log("播放声音---" + clipName); }
public void PlayByName(AudioType adtype, AudioNams clipName, bool loop, Action acion = null) { AudioClip clip = FindAudioClip(clipName.ToString()); Debug.Log("播放声音---" + clipName); if (adtype == AudioType.Fixed) { _cas.Play(adtype, _source, clip, null, 1, 1, loop, acion); } else { _cas.Play(adtype, null, clip, emitter.transform, 1, 1, loop, acion); } }
public void AddStat(InteractableColor type, float amount) { switch (type) { case InteractableColor.BLUE: { BlueStatMax += Mathf.Clamp(amount, 1f, 100f); statUpdateEvent.Invoke(InteractableColor.BLUE); break; } case InteractableColor.RED: { RedStatMax += Mathf.Clamp(amount, 1f, 100f); statUpdateEvent.Invoke(InteractableColor.RED); break; } case InteractableColor.GREEN: { GreenStatMax += Mathf.Clamp(amount, 1f, 100f); statUpdateEvent.Invoke(InteractableColor.GREEN); break; } default: { Debug.LogWarning("Did not assign any stat type to raise!"); break; } } PlayerUI.instance.UpdateSliders(); audioSource.SetClip(gainStatSound, false); audioSource.Play(); }
void FirstCut() { timer += Time.deltaTime; if (customAudioSource.source.clip != walkUpLadderSong) { customAudioSource.source.clip = walkUpLadderSong; customAudioSource.Play(walkUpLadderSong); } cutSceneCamera.enabled = true; playerMove.SetBool("Climbing", true); playerAnim.SetBool("Climbing", true); cutSceneCamera.transform.position = Vector3.MoveTowards(cutSceneCamera.transform.position, panPoints [1].transform.position, 0.02f); if (!customAudio.isPlaying() && !playedFanfare) { customAudio.PlayOnce(); playedFanfare = true; } if (timer >= 2) { TransistToSecondCut(); } }
public void PlayerHit(GameObject hit, EnemyDebris hitter) { if (hit == gameObject) { audioSource_self.Play(); PlayerHit(hitter.damage); } ; }
void Update() { if (active) { player.GetComponent <SpriteRenderer> ().enabled = true; if (kicked) { timer += Time.deltaTime; trumpAnim.SetBool("Kick", true); playerAnim.SetBool("GetKicked", true); if (customAudioSource.source.clip != KickedFromWallSong) { customAudioSource.source.clip = KickedFromWallSong; customAudioSource.Play(KickedFromWallSong); invokeActive = true; } if (timer >= 1) { GM.NextRound(); playerAnim.SetBool("GetKicked", false); trumpAnim.SetBool("Kick", false); timer = 0; kicked = false; } } } else if (!active) { player.GetComponent <SpriteRenderer> ().enabled = false; } if (invokeActive) { Invoke("ser", KickedFromWallSong.length); } }
public void Hurt(float damage) { if (!animator.GetBool("dead")) { health = health - damage * Time.deltaTime; animator.SetTrigger("hit"); audiousource.Play(); if (health <= 0f) { Kill(0.1f); } } ; }
void Update() { if (GM.cards.Count == 0 && pcl.cuts == PlayerClimbLadder.Cuts.secondCut) { MainCamera.GetComponent <CustomAudioSource>().Stop(); cas.Play(); } if (GM.showCards) { win.SetActive(GM.cards.Count == 0); if (GM.cards.Count == 0) { tooltip.enabled = false; } politicians.SetActive(GM.cards.Count != 0); } }
void Update() { //main menu handler / UI handler if (GM.gameLoopActive) { ui.enabled = true; mainMenu.enabled = false; } //death screen handler if (!GM.Player.Alive) { deathScreen.enabled = true; ui.enabled = false; //Hacky place to make it play the lose music. Sorry :( CustomAudioSource cas = deathScreen.GetComponent <CustomAudioSource>(); if (!cas.isPlaying()) { mainCamera.GetComponent <CustomAudioSource>().Stop(); cas.Play(); } } else { deathScreen.enabled = false; } //pasue menu handler if (GM.gamePaused) { pauseMenu.enabled = true; } else { pauseMenu.enabled = false; } tutorial.enabled = GM.inTutorial; if (GM.roundWon) { winScreen.enabled = true; } }
void Start() { _audioMixer = AudioMixer.Instance; _source = GetComponent <CustomAudioSource>(); // Get the first track in Assets/Resources. foreach (var item in Directory.GetDirectories(Directory.GetCurrentDirectory() + "/Assets/Resources/").ToList()) { foreach (var track in Directory.GetFiles(item).Where(n => Path.GetExtension(n) == ".wav")) { _track = _audioMixer.Load(track); break; } break; } _source.Play(_track); _source.Channel.setMode(FMOD.MODE.LOOP_NORMAL); _source.Channel.setLoopCount(-1); }
private IEnumerator ReallyStart() { yield return(new WaitForSeconds(StartupTime)); foreach (var s in Sources) { Debug.Log(s.name); s.Speed = MutedSourceJustForDefaultSpeed.Speed; s.Play(); MusicSelector.Source = s; } MutedSourceJustForDefaultSpeed.Play(); foreach (var b in _buttons) { b.MyBeat.Reset(); b.MyBeat.Run(); } ResetTempoDegrationTime(); _isStarting = false; }