void Awake()
 {
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of SoundEffectsHelper!");
     }
     Instance = this;
 }
Пример #2
0
    void SpawnSoundEffect(AudioClip audioClip, Vector3 position, float duration, float volume, float pitch)
    {
        GameObject        soundEffect       = (GameObject)Instantiate(soundEffectPrefab, position, transform.rotation);
        soundEffectScript soundEffectScript = soundEffect.GetComponent <soundEffectScript> ();

        soundEffectScript.duration  = duration;
        soundEffectScript.volume    = volume;
        soundEffectScript.pitch     = pitch;
        soundEffectScript.audioClip = audioClip;
    }