Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Time.time > nextAmmo && active && curAmmo > 0)
     {
         nextAmmo = Time.time + ammoRate;
         if (player.AddAmmo())
         {
             curAmmo--;
         }
     }
     if (Time.time > nextHealth && active && curHealth > 0)
     {
         nextHealth = Time.time + (ammoRate * 2);
         if (player.AddHealth())
         {
             curHealth--;
         }
     }
     if (curAmmo <= 0 && curHealth <= 0)
     {
         Destroy(gameObject);
     }
 }