public virtual void Unpower() { if (Playing) { SoundClipPlayer.PlayClip(_unpowerSound); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag(_impactTag) || (collision.attachedRigidbody.velocity.magnitude < 0.01f && GetComponentInParent <Rigidbody2D>().velocity.magnitude > 0.01f)) { SoundClipPlayer.PlayClip(_impactClip, 0.8f); } }
/// <summary> /// Plays the given sound at the given volume and position /// </summary> /// <param name="clip">Clip.</param> /// <param name="volume">Volume.</param> /// <param name="atPosition">Where to spawn the audioclip.</param> public void PlaySound(AudioClip clip, float volume, Vector3 atPosition) { GameObject clipGO = Instantiate(this.SoundClipPlayerPrefab, atPosition, Quaternion.identity); SoundClipPlayer soundPlayer = clipGO.GetComponent <SoundClipPlayer>(); soundPlayer.Play(clip, volume); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag(_killTag)) { _dead = true; SoundClipPlayer.PlayClip(_deathSound); } else if (collision.CompareTag(_exitTag) && !_dead) { LevelController.WinLevel(); } }
private void Awake() { if (_instance) { Destroy(this); return; } else { _instance = this; } _source = GetComponent <AudioSource>(); }
public void Play(AudioClip clip) { SoundClipPlayer.PlayClip(clip, _volume); }