protected override void StartEmerging() { base.StartEmerging(); // pick one of the configurations at random currentConfig = configurations[CodeTools.WeightedRandomSelection(config_randomWeights)]; currentConfig.gameObject.SetActive(true); currentConfig.InitializeContainerConfiguration(); }
public bool PlaySFX(float vol) { if ((Time.time - lastTriggerTime) < dontRetriggerTime) { return(false); } lastTriggerTime = Time.time; int index = CodeTools.WeightedRandomSelection(clips_randomWeights); audioSource.pitch = Random.Range(clips_randPitchRanges[index].min, clips_randPitchRanges[index].max); audioSource.clip = clips[index]; // this stricly shouldn't be necessary audioSource.PlayOneShot(clips[index], vol); return(true); }
// returns an index into objectSpots[] appropriate for a goalObject to be placed private int GetIndexForGoalObject() { return(CodeTools.WeightedRandomSelection(goalSpots_randWeights)); }
public GameObject GetRandomTreasure() { return(treasures[CodeTools.WeightedRandomSelection(treasure_randWeights)]); }