// Use this for initialization void Start() { ExplosionHelper.Add(this); numberOfHumans++; humanId = humanInstanceCount++; DataCollector.Add("Total # of people", 1f); GenericHumanSounds.HumanCountChange(); initHumanProfile(); StartCoroutine(reportStats()); }
private IEnumerator humanReachedGoal() { HumanCollider[] humanColliders = GetComponentsInChildren <HumanCollider> (); foreach (HumanCollider collider in humanColliders) { collider.GetComponent <BoxCollider> ().center = new Vector3(0f, 0f, 1000f); } yield return(null); Destroy(this.gameObject); // if (health > 0f) { PubSub.publish("points:inc", PointCalculator.humanDestinationPoints); DataCollector.Add("Humans reached goal", 1f); // } numberOfHumans--; GenericHumanSounds.HumanCountChange(); }
void Start() { GenericHumanSounds.instance = this; PubSub.subscribe("Volume:ambient", this); GenericHumanSounds.ambientSoundSources = new List <AudioSource> (ambientHumanSounds.Count); for (int i = 0; i < ambientHumanSounds.Count; i++) { AudioSource ambientSoundSource = Game.instance.gameObject.AddComponent <AudioSource> (); ambientSoundSource.playOnAwake = false; ambientSoundSource.spatialBlend = 1f; ambientSoundSource.clip = GenericHumanSounds.instance.ambientHumanSounds[i]; ambientSoundSource.loop = true; ambientSoundSource.volume = volume; ambientSoundSource.time = Misc.randomRange(0f, GenericHumanSounds.instance.ambientHumanSounds[i].length); GenericHumanSounds.ambientSoundSources.Add(ambientSoundSource); } }
public static void HumanCountChange() { int amount = HumanLogic.numberOfHumans; int calculatedNumberOfChannels = Mathf.CeilToInt((float)amount / humansPerChannel); int wantedNumberOfChannels = Mathf.Clamp(calculatedNumberOfChannels, 1, GenericHumanSounds.instance.ambientHumanSounds.Count); if (wantedNumberOfChannels < numberOfActiveChannels) { for (int i = wantedNumberOfChannels; i < numberOfActiveChannels; i++) { GenericHumanSounds.stopAmbientSound(i); } } else if (wantedNumberOfChannels > numberOfActiveChannels) { for (int i = numberOfActiveChannels; i < wantedNumberOfChannels; i++) { GenericHumanSounds.startAmbientSound(i); } } numberOfActiveChannels = wantedNumberOfChannels; }