コード例 #1
0
 // This function will get called when the Player presses the spacebar (have a look at the InputManager
 // script that I have attached to the Hero GameObject). You are going to have to write the code that
 // goes into this function that will (a) if the switch is enabled will turn it on if it is off and
 // push the Vase off the ledge and (b) if the switch is enabled will turn it off if it is on.
 public void FlipTheSwitch()
 {
     if (switchEnabled == true)
     {
         theSwitch.TurnOn();
         vaseRB.AddForce(forceToApply, ForceMode2D.Impulse);
     }
     else
     {
         theSwitch.TurnOff();
     }
 }