Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
|
- using System;
- using System.Collections;
- using UnityEngine;
-
- public class CIGSoundOnRandomInterval : CIGSoundOnEvent
- {
- protected override void Start()
- {
- base.Start();
- base.StartCoroutine(this.RandomIntervalCoroutine());
- }
-
- private IEnumerator RandomIntervalCoroutine()
- {
- while ((double)this.minimumInterval >= 0.0)
- {
- if (this.maximumInterval < this.minimumInterval)
- {
- UnityEngine.Debug.LogError("Maximum interval can't be smaller than minimum interval.");
- yield break;
- }
- float interval = UnityEngine.Random.Range(this.minimumInterval, this.maximumInterval);
- yield return new WaitForSeconds(interval);
- base.PlaySound();
- }
- UnityEngine.Debug.LogError("Minimum interval can't be smaller than zero.");
- yield break;
- yield break;
- }
-
- [SerializeField]
- private float minimumInterval = 10f;
-
- [SerializeField]
- private float maximumInterval = 10f;
- }
|