void OnTriggerExit2D(Collider2D other)
    {
        Debug.Log("Someone left the switch trigger");

        theSwitch.turnOff();
        theBulb.turnOff();
    }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) == true) //has spacebar been pressed
     {
         if (theSwitch != null)                   //the variable f the switch is equal to nothing (if it hadnt been wired up), if u made a mistake and didnt drag it over, call the function on the switchcontroller script
         {
             theSwitch.toggleSwitch();            //it would work perfectly only if u wired it up, this is just in case it hasnt
             if (theBulb.bulbOn == true)
             {
                 theBulb.turnOff();
             }
             else
             {
                 theBulb.turnOn();
             }
         }
     }
 }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) == true)
        {
            if (theSwitch != null)
            {
                theSwitch.toggleSwitch();

                if (theBulb.BulbOn == true)
                {
                    theBulb.turnOff();
                }
            }

            else
            {
                theBulb.turnOn();
            }
        }
    }
Пример #4
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) == true)
     {
         if (theSwitch != null)
         {
             if (theSwitch.switchToggle == true)
             {
                 ;
             }
             {
                 if (theBulb.LightOff == true)
                 {
                     theBulb.turnOn();
                 }
                 else
                 {
                     theBulb.turnOff();
                 }
             }
         }
     }
 }
Пример #5
0
 public void turnOff()
 {
     switchOff = true;
     switchAnimator.SetBool("SwitchOff", switchOff);
     bulbController.turnOff();
 }