Exemple #1
0
 public override void Initialize()
 {
     base.Initialize();
     if (Sounds != null)
     {
         for (int i = 0; i < Sounds.Count; i++)
         {
             WeatherMakerSoundScript script = Sounds[i];
             if (script != null)
             {
                 // make a copy of the profile as it uses internal state variables
                 Sounds[i]     = script = ScriptableObject.Instantiate(script);
                 script.Parent = Parent;
                 script.Initialize();
             }
         }
     }
 }
Exemple #2
0
        public override void Update()
        {
            base.Update();
            if (Sounds != null)
            {
                // update all sounds in group
                for (int i = Sounds.Count - 1; i >= 0; i--)
                {
                    WeatherMakerSoundScript script = Sounds[i];

                    // if the sound is null or audio source is null, sound was destroyed, remove it
                    if (script == null || script.AudioSourceLoop == null || script.AudioSourceLoop.AudioSource == null)
                    {
                        script.OnDestroy();
                        Sounds.RemoveAt(i);
                    }
                    else
                    {
                        script.Update();
                    }
                }
            }
        }