예제 #1
0
    void setLightControl()
    {
        if (!SerialComReader.isInSerial)
        {
            if (Input.GetAxisRaw("LightControl") > 0 && lightIntensity != maximumLight)
            {
                lightIntensity += lightIncreaseSensitivity;

                if (lightIntensity > maximumLight)
                {
                    lightIntensity = maximumLight;
                }

                float lightRange = minimumLightRange + (lightIntensity - minimumLight) * (maximumLightRange - minimumLightRange);
                lt.range = lightRange;

                IsMovable.changeLightRange(lightRange);
            }
            if (Input.GetAxisRaw("LightControl") < 0 && lightIntensity != minimumLight)
            {
                lightIntensity -= lightIncreaseSensitivity;

                if (lightIntensity < minimumLight)
                {
                    lightIntensity = minimumLight;
                }

                float lightRange = minimumLightRange + (lightIntensity - minimumLight) * (maximumLightRange - minimumLightRange);
                lt.range = lightRange;

                IsMovable.changeLightRange(lightRange);
            }
        }
        else
        {
            lightIntensity = 1.0f + SERIAL_ARDUINO_.SerialCom.previousData [0] / 255.0f;

            float lightRange = minimumLightRange + (lightIntensity - minimumLight) * (maximumLightRange - minimumLightRange);
            lt.range = lightRange;

            IsMovable.changeLightRange(lightRange);
        }
    }
예제 #2
0
 void setInitialParameters()
 {
     IsMovable.changeLightRange(minimumLightRange);
 }