Пример #1
0
    // Update is called once per frame
    void Update()
    {
        switch (lightControlState)
        {
        case LightControlState.FallOutOnToOff:
            step -= (Time.deltaTime / fallOutDelay) * Time.timeScale;

            if (step <= 0f)
            {
                step = 0f;
                lightControlState = LightControlState.Off;
            }

            lightToControl.intensity = lightCurveFallOut.Evaluate(step) * (lightOnIntensity - lightOffIntensity) + lightOffIntensity;
            break;

        case LightControlState.FallOutOffToOn:
            step += (Time.deltaTime / fallOutDelay) * Time.timeScale;

            if (step >= 1f)
            {
                step = 1f;
                lightControlState = LightControlState.On;
            }

            lightToControl.intensity = lightCurveFallOut.Evaluate(step) * (lightOnIntensity - lightOffIntensity) + lightOffIntensity;
            break;

        default:
            break;
        }
    }
Пример #2
0
 public LightControlStatus(DateTimeOffset detectedOnTime, DateTimeOffset hueShiftTookControlTime, DateTimeOffset detectedManualChangeTime, DateTimeOffset transitionRequestedTime, TimeSpan requestedTransitionDuration, LightControlState lightControlState, Light light)
 {
     DetectedOnTime              = detectedOnTime;
     HueShiftTookControlTime     = hueShiftTookControlTime;
     DetectedManualChangeTime    = detectedManualChangeTime;
     TransitionRequestedTime     = transitionRequestedTime;
     RequestedTransitionDuration = requestedTransitionDuration;
     LightControlState           = lightControlState;
     Light = light;
 }
Пример #3
0
 public void SetLightActivate(bool flag)
 {
     if (flag)
     {
         lightControlState = LightControlState.FallOutOffToOn;
     }
     else
     {
         lightControlState = LightControlState.FallOutOnToOff;
     }
 }
Пример #4
0
 public CachedControlPair(LightControlPair light)
 {
     this.Properties      = light.Properties.DeepClone();
     this.PowerState      = light.PowerState;
     this.AppControlState = light.AppControlState;
     this.NetworkLight    = new AppLightState(light.NetworkLight);
     this.ExpectedLight   = light.ExpectedLight.DeepClone();
     if (light.Transition != null)
     {
         this.Transition = light.Transition.DeepClone();
     }
     this.ResetOccurred = light.ResetOccurred;
 }