Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        Color c = Color.white;

        c.r              = (int)receiver.GetValue(0) / 127f;
        c.g              = (int)receiver.GetValue(1) / 127f;
        c.b              = (int)receiver.GetValue(2) / 127f;
        _light.color     = c;
        _light.spotAngle = Mathf.Lerp(10, 65, (int)receiver.GetValue(3) / 127f);
        _light.intensity = (int)receiver.GetValue(4) / 127f;
    }
    /// <summary>
    /// Check if the gate requires multiple buttons to be pressed simultaneously
    /// and open door if the value returns true
    /// </summary>
    private void GateHandler()
    {
        bool playerOpenGate   = ShouldOpenDoor((float)receiver.GetValue(oscValue));
        bool audienceOpenGate = ShouldOpenDoor((float)receiver.GetValue(audienceOscValue));

        if (!requiresAudience)
        {
            if (playerOpenGate)
            {
                gameObject.SetActive(false);
            }
        }
        else
        {
            if (playerOpenGate && audienceOpenGate)
            {
                gameObject.SetActive(false);
            }
        }
    }