コード例 #1
0
    void Update()
    {
        //-----------------------------------------------
        // Stop active co-routines when light is disabled
        //-----------------------------------------------
        if (!Enabled && !coRoutinesStopped)
        {
            StopAllCoroutines();
            coRoutinesStopped = true;
        }

        if (!visualize)
        {
            lightAction = GetLightAction();
            StartCoroutine(lightAction.ModulateLight(lightObj, speed, upperIntensityBounds, lowerIntensityBounds));
        }
        else if (visualize)
        {
            lightObj.intensity = ((audioVisualizer.audioBandBuffer[band] * scaleMagnitude) * (maxIntensity - minIntensity) + minIntensity);
        }

        if (rotate)
        {
            rotateType.Rotate(gameObject, xAngle, yAngle, zAngle, period, rotationSpeed);
        }

        if (colorRandomizer)
        {
            if (gameObject.GetComponent <RandomColor>() == null)
            {
                randomColor = gameObject.AddComponent <RandomColor>();
            }

            randomColor.Randomize(randomizeTime);
        }
    }