// Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E) && collectable)
     {
         while (currentClips != 0 && playerAmmo.AddAmmo(type))
         {
             currentClips--;
         }
         if (currentClips == 0)
         {
             Destroy(gameObject);
         }
     }
 }
Exemple #2
0
 private void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         if (gun != null)
         {
             gun.AddAmmo(type);
         }
         AMS_ScoreController.increaseScore(scoreGainedOnPickup);
         if (powerupSound != null)
         {
             GameObject.FindObjectOfType <AudioSwitcherScript>().PlaySound(powerupSound);
         }
         Destroy(gameObject);
     }
 }