public void IncrementAmmo(Bullet.Kind k) { Magazine magazine = magazines [(int)k]; int ammo = Mathf.RoundToInt(magazine.maxBullets * 0.1f); int newAmmo = magazine.remainingBullets + ammo; magazine.remainingBullets = (magazine.maxBullets < newAmmo) ? magazine.maxBullets : newAmmo; }
void changeColor() { Magazine[] magazines = tank.GetComponent <AmmoController> ().magazines; Bullet bullet = magazines [Random.Range(0, magazines.Length)].bullet; kind = bullet.kind; transform.Find("Ammo").GetComponent <MeshRenderer> ().materials [0].color = bullet.color; transform.Find("Minimap object").GetComponent <MeshRenderer> ().materials [0].color = bullet.color; }