コード例 #1
0
    void Start()
    {
        if (audioSource == null)
        {
            audioSource = GetComponent <AudioSource>();
        }

        if (audioSource == null)
        {
            Debug.LogError("No AudioSource assigned or detected.");
        }

        if (clips.Length == 0)
        {
            Debug.LogError("No AudioClips assigned.");
        }

        if (
            (clips.Length != clips_randomWeights.Length) ||
            (clips.Length != clips_randPitchRanges.Length) ||
            (clips_randomWeights.Length != clips_randPitchRanges.Length)
            )
        {
            Debug.LogError("Arrays whose names start with the word 'clips' are parallel arrays and must have the name number of elements.");
        }


        CodeTools.ValidateWeightedRandomArray(clips_randomWeights, clips.Length);

        MinMaxValues minmax = new MinMaxValues(-3f, 3f);

        CodeTools.ValidateMinMaxArray(clips_randPitchRanges, minmax, minmax);

        lastTriggerTime = dontTriggerUntil;  // this is how dontTriggerUntil is implemented
    }
コード例 #2
0
    void Start()
    {
        if (treasures.Length == 0)
        {
            Debug.LogError("treasures list not assigned.");
        }

        CodeTools.ValidateWeightedRandomArray(treasure_randWeights, treasures.Length);
    }
コード例 #3
0
    void Awake()
    {
        CodeTools.ValidateWeightedRandomArray(spots_randWeights, objectSpots.Length);
        CodeTools.ValidateWeightedRandomArray(goalSpots_randWeights, objectSpots.Length);

        if ((numSpotsToFill < 0) || (numSpotsToFill > objectSpots.Length))
        {
            Debug.LogError("numSpotsToFill must be at least 0 and no more than the number of elements in objectSpots, but instead it is " + numSpotsToFill);
        }

        foreach (Transform spot in objectSpots)
        {
            if (CodeTools.GetComponentFromNearestAncestor <TreasureTable>(spot.gameObject) == null)
            {
                Debug.LogError("No TreasureTable found on " + spot.gameObject + " nor any of its ancestors.");
            }
        }

        environment = GameObject.FindObjectOfType <EnvironmentManager>();
        if (environment == null)
        {
            Debug.LogError("EnvironmentManager not found.");
        }

        gameplayManager = GameObject.FindObjectOfType <GameplayManager>();
        if (gameplayManager == null)
        {
            Debug.LogError("GameplayManager not found!");
        }

        GameObject collisionMarkers;

        collisionMarkers = GameObject.Find("CollisionMarkers");
        if (collisionMarkers == null)
        {
            collisionMarkers = new GameObject("CollisionMarkers");
        }

        if (environment.propsFolder != null)
        {
            collisionMarkers.transform.parent = environment.propsFolder.transform;
        }
    }
コード例 #4
0
    protected override void Start()
    {
        base.Start();

        CodeTools.ValidateWeightedRandomArray(config_randomWeights, configurations.Length);
    }