Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if ((Input.GetKeyDown(KeyCode.LeftShift) || Input.GetMouseButtonDown(0)) && interactablePodium != null)
        {
            print("Mouse 0");


            Ray        ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
            RaycastHit hitInfo;
            if (Physics.Raycast(ray, out hitInfo, 20))
            {
                if (hitInfo.collider.gameObject.tag == "Podium")
                {
                    PodiumLogic script = (PodiumLogic)interactablePodium.GetComponent("PodiumLogic");
                    script.switchLed();
                }
                if (hitInfo.collider.gameObject.tag == "Nature")
                {
                    PodiumLogic script1 = (PodiumLogic)podium1.GetComponent("PodiumLogic");
                    PodiumLogic script2 = (PodiumLogic)podium2.GetComponent("PodiumLogic");

                    if (!script1.isLedConnected && !script2.isLedConnected)
                    {
                        NatureLogic script = (NatureLogic)interactablePodium.GetComponent("NatureLogic");
                        script.turnOn();
                    }
                }
            }
        }
        if ((Input.GetKeyDown(KeyCode.LeftControl) || Input.GetMouseButtonDown(1)) && interactablePodium != null)
        {
            print("Mouse 1");

            Ray        ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
            RaycastHit hitInfo;
            if (Physics.Raycast(ray, out hitInfo, 20))
            {
                if (hitInfo.collider.gameObject.tag == "Podium")
                {
                    PodiumLogic script = (PodiumLogic)interactablePodium.GetComponent("PodiumLogic");
                    script.switchLedConnectionState();
                }
            }
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     podiumLogic = GameObject.Find("Logic").GetComponent <PodiumLogic>();
 }
Ejemplo n.º 3
0
 void Start()
 {
     podium1Logic = (PodiumLogic) podium1.GetComponent("PodiumLogic");
     podium2Logic = (PodiumLogic) podium2.GetComponent("PodiumLogic");
     oscScript = (C_Receiver) oscObject.GetComponent("C_Receiver");
 }
Ejemplo n.º 4
0
 void Start()
 {
     podium1Logic = (PodiumLogic)podium1.GetComponent("PodiumLogic");
     podium2Logic = (PodiumLogic)podium2.GetComponent("PodiumLogic");
     oscScript    = (C_Receiver)oscObject.GetComponent("C_Receiver");
 }