Exemplo n.º 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player" || other.tag == "Wall")
     {
         if (other.tag == "Player")
         {
             other.GetComponent <FirstPersonController>().gotHit = true;
             flashLight.GetComponent <Flashlight>().currentBattery--;
             flashlightUI.SetBatteryLevel(flashLight.GetComponent <Flashlight>().currentBattery);
         }
         Debug.Log("Destroy");
         Destroy(transform.gameObject);
     }
 }
Exemplo n.º 2
0
 void OnTriggerStay(Collider other)
 {
     showText = true;
     if (!safeRemove)
     {
         if (Input.GetKeyUp(KeyCode.E))
         {
             mainBattery = Flight.GetComponent <Flashlight>().currentBattery;
             Batteries   = 1;
             other.GetComponent <FirstPersonController>().pickedItemUp = true;
             Flight.GetComponent <Flashlight>().currentBattery         = Batteries + mainBattery;
             flashlightUI.SetBatteryLevel(Flight.GetComponent <Flashlight>().currentBattery);
             safeRemove = true;
             if (safeRemove)
             {
                 Destroy(this.gameObject);
             }
         }
     }
 }
Exemplo n.º 3
0
 void minusBattery(int battery)
 {
     currentBattery -= battery;
     flashlightUI.SetBatteryLevel(currentBattery);
 }