예제 #1
0
    public override ExtendedEventArgs process()
    {
        ResponseLightEventArgs args = null;

        args       = new ResponseLightEventArgs();
        args.light = light;
        Debug.Log("Light color is: " + light);
        return(args);
    }
예제 #2
0
    // Turn on and off lights/wall mesh renderers
    public void ResponseLight(ExtendedEventArgs eventArgs)
    {
        ResponseLightEventArgs args         = eventArgs as ResponseLightEventArgs;
        GameObject             lightTrigger = GameObject.FindGameObjectWithTag(args.light);

        lightTrigger.GetComponent <ActivateLight>().source.GetComponent <AudioSource>().Play();
        // Grab all lights to render from the game object
        EnableLight[] light = lightTrigger.GetComponent <ActivateLight>().lights;
        // Grab all walls to render from the game object
        EnableRender[] wall = lightTrigger.GetComponent <ActivateRender>().rend;

        // Turn on all the lights for this color
        for (int i = 0; i < light.Length; i++)
        {
            light[i].myLight.enabled = !light[i].myLight.enabled;
        }
        // Flip walls to be rendered for this color
        for (int i = 0; i < wall.Length; i++)
        {
            wall[i].renderObject.enabled = !wall[i].renderObject.enabled;
        }
    }