Exemple #1
0
 private void OnChangeRequested <T>(LightProperty <T> sender, bool immediate)
 {
     if (outgoing == null || outgoing.IsFaulted || outgoing.IsFaulted || outgoing.IsCanceled)
     {
         outgoing = ProcessOutgoing();
     }
 }
Exemple #2
0
        public Provider(int index, NodeService nodeService)
        {
            Index            = index;
            this.nodeService = nodeService;

            power = new Udp2LightProperties.Power();
            power.ChangeRequested += OnChangeRequested;

            color = new Udp2LightProperties.Color();
            color.ChangeRequested += OnChangeRequested;

            mode = new Udp2LightProperties.Mode();
            mode.ChangeRequested += OnChangeRequested;

            brightness = new Udp2LightProperties.Brightness();
            brightness.ChangeRequested += OnChangeRequested;

            colorTemp = new Udp2LightProperties.ColorTemp();
            colorTemp.ChangeRequested += OnChangeRequested;

            scene = new Udp2LightProperties.Scene();
            scene.ChangeRequested += OnChangeRequested;

            properties = new LightProperty[] { power, color, mode, brightness, colorTemp, scene };
        }
Exemple #3
0
        public Provider(int index, Client udpClient)
        {
            Index  = index;
            client = udpClient;

            power = new Udp2LightProperties.Power();
            power.ChangeRequested += OnChangeRequested;

            color = new Udp2LightProperties.Color();
            color.ChangeRequested += OnChangeRequested;

            mode = new Udp2LightProperties.Mode();
            mode.ChangeRequested += OnChangeRequested;

            brightness = new Udp2LightProperties.Brightness();
            brightness.ChangeRequested += OnChangeRequested;

            colorTemp = new Udp2LightProperties.ColorTemp();
            colorTemp.ChangeRequested += OnChangeRequested;

            scene = new Udp2LightProperties.Scene();
            scene.ChangeRequested += OnChangeRequested;

            properties = new LightProperty[] { power, color, mode, brightness, colorTemp, scene };
        }
Exemple #4
0
 public void Interact(C_DisplayImage currentDisplay)
 {
     if (displayimage.CurrentWall < 10)
     {
         Debug.Log("turn off");
         displayimage.CurrentWall += 10;
         if (door.cat.activeSelf == true)
         {
             Invoke("Catlight", 3);
         }
         lightproperty = LightProperty.off;
         if (puzzlecontrol.puzzle > 10 && door.DoorProperty == C_DoorInteraction.DoorState.close)
         {
             last.gameObject.SetActive(true);
             first.gameObject.SetActive(false);
             canvas.gameObject.SetActive(false);
             Debug.Log("clear!");
         }
     }
     else if (displayimage.CurrentWall > 10)
     {
         Debug.Log("turn on");
         displayimage.CurrentWall -= 10;
         lightproperty             = LightProperty.on;
     }
 }
Exemple #5
0
 public void Catlight()
 {
     if (displayimage.CurrentWall > 10)
     {
         Debug.Log("cat turn light on!");
         displayimage.CurrentWall -= 10;
         lightproperty             = LightProperty.on;
     }
 }
Exemple #6
0
    public void OnClickMainLight()
    {
        if (currentDisplay.CurrentRoom < 10)
        {
            currentDisplay.CurrentRoom = currentDisplay.CurrentRoom + 10;
            lightproperty = LightProperty.off;
        }
        else
        {
            currentDisplay.CurrentRoom = currentDisplay.CurrentRoom - 10;
            lightproperty = LightProperty.on;
        }

        if (lightproperty == LightProperty.off && moodOff.activeSelf && lantern.activeSelf && bedOpen.activeSelf &&
            curtain.activeSelf && window.activeSelf)
        {
            Rbutton.SetActive(false);
            Lbutton.SetActive(false);
            inventory.SetActive(false);
            StartCoroutine(SomeCoroutine());
            Debug.Log("clear!");
            return;
        }
    }
    /// <summary>
    /// This is callled when this commponent is reset. 
    /// </summary>
    public override void Reset()
    {
        base.Reset();

        targetProperty = Defaults.targetProperty;
    }
Exemple #8
0
 set => SetValue(LightProperty, value);
    /// <summary>
    /// This is callled when this commponent is reset.
    /// </summary>
    public override void Reset()
    {
        base.Reset();

        targetProperty = Defaults.targetProperty;
    }
Exemple #10
0
    /// <summary>
    /// This function is used to help set basic properties on a light
    /// in a generic way.
    /// </summary>
    /// <param name="light">The light whose properties are to be set.</param>
    /// <param name="targetProperty">The target property to set.</param>
    /// <param name="propertyValue">The value to set the target property to.</param>
    public static void SetLightProperty(Light light, LightProperty targetProperty, float propertyValue)
    {
        //check if the light is null
        if (light == null)
        {
            return;
        }

        //set the property
        switch (targetProperty)
        {
        case LightProperty.ColorRed:
            light.color = new Color(propertyValue,
                                    light.color.g,
                                    light.color.b,
                                    light.color.a);
            break;

        case LightProperty.ColorGreen:
            light.color = new Color(light.color.r,
                                    propertyValue,
                                    light.color.b,
                                    light.color.a);
            break;

        case LightProperty.ColorBlue:
            light.color = new Color(light.color.r,
                                    light.color.g,
                                    propertyValue,
                                    light.color.a);
            break;

        case LightProperty.ColorRGB:
            light.color = new Color(propertyValue,
                                    propertyValue,
                                    propertyValue,
                                    light.color.a);
            break;

        case LightProperty.ColorAlpha:
            light.color = new Color(light.color.r,
                                    light.color.g,
                                    light.color.b,
                                    propertyValue);
            break;

        case LightProperty.Intensity:
            light.intensity = propertyValue;
            break;

        case LightProperty.Range:
            light.range = propertyValue;
            break;

        case LightProperty.SpotAngle:
            light.spotAngle = propertyValue;
            break;

        case LightProperty.ShadowBias:
            light.shadowBias = propertyValue;
            break;

        case LightProperty.ShadowSoftness:
            light.shadowSoftness = propertyValue;
            break;

        case LightProperty.ShadowSoftnessFade:
            light.shadowSoftnessFade = propertyValue;
            break;

        case LightProperty.ShadowStrength:
            light.shadowStrength = propertyValue;
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// This function is used to help set basic properties on a light
    /// in a generic way.
    /// </summary>
    /// <param name="light">The light whose properties are to be set.</param>
    /// <param name="targetProperty">The target property to set.</param>
    /// <param name="propertyValue">The value to set the target property to.</param>
	public static void SetLightProperty(Light light, LightProperty targetProperty, float propertyValue)
	{
		//check if the light is null
		if (light == null)
		{
			return;
		}

        //set the property
        switch (targetProperty)
        {
            case LightProperty.ColorRed:
                light.color = new Color(propertyValue,
                                        light.color.g,
                                        light.color.b,
                                        light.color.a);
                break;
            case LightProperty.ColorGreen:
                light.color = new Color(light.color.r,
                                        propertyValue,
                                        light.color.b,
                                        light.color.a);
                break;
            case LightProperty.ColorBlue:
                light.color = new Color(light.color.r,
                                        light.color.g,
                                        propertyValue,
                                        light.color.a);
                break;
            case LightProperty.ColorRGB:
                light.color = new Color(propertyValue,
                                        propertyValue,
                                        propertyValue,
                                        light.color.a);
                break;
            case LightProperty.ColorAlpha:
                light.color = new Color(light.color.r,
                                        light.color.g,
                                        light.color.b,
                                        propertyValue);
                break;
            case LightProperty.Intensity:
                light.intensity = propertyValue;
                break;
            case LightProperty.Range:
                light.range = propertyValue;
                break;
            case LightProperty.SpotAngle:
                light.spotAngle = propertyValue;
                break;
            case LightProperty.ShadowBias:
                light.shadowBias = propertyValue;
                break;
            case LightProperty.ShadowSoftness:
                light.shadowSoftness = propertyValue;
                break;
            case LightProperty.ShadowSoftnessFade:
                light.shadowSoftnessFade = propertyValue;
                break;
            case LightProperty.ShadowStrength:
                light.shadowStrength = propertyValue;
                break;
            default:
                break;
        }
	}