예제 #1
0
    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();
    }
예제 #2
0
    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);
    }
예제 #3
0
 // returns an index into objectSpots[] appropriate for a goalObject to be placed
 private int GetIndexForGoalObject()
 {
     return(CodeTools.WeightedRandomSelection(goalSpots_randWeights));
 }
예제 #4
0
 public GameObject GetRandomTreasure()
 {
     return(treasures[CodeTools.WeightedRandomSelection(treasure_randWeights)]);
 }