private void PlaySoundFrom(SoundStateInfo state) { if (Time.time > state.barredTime) { AudioClip clip = state.sounds[Random.Range(0, state.sounds.Length)]; SoundManagerController.Instance.PlaySoundAt(clip, transform); state.barredTime = clip.length + Time.time; timeTilPlay += clip.length; } }
public void SetState(string name) { SoundStateInfo found = getState(name); if (found == null) Debug.Log("Sound state [" + name + "] does not exist"); else { if( currentState == null ) timeTilPlay = Random.Range(found.minDelay, found.maxDelay); currentState = found; } }
void Start() { currentState = null; }