void Update() { if (Input.GetButtonDown("Ability") || active) { if (!active) { startHighNoon(); } else if (Time.realtimeSinceStartup - startTime >= activeTime) { endHighNoon(); } else { if (!audioSource.isPlaying) { audioSource.PlayOneShot(tickSound); } charge = 100 * ((activeTime + startTime - Time.realtimeSinceStartup) / activeTime); if (weapon.getAmmo() == 0) { endHighNoon(); } } } }
void Update() { WeaponAttributes wep = Player.getActiveWeapon(); Rect uvrec = img.uvRect; if (!wep) { uvrec.width = 0; img.uvRect = uvrec; return; } uvrec.width = wep.getAmmo(); img.uvRect = uvrec; img.transform.localScale = new Vector3(wep.getAmmo(), 1.0f, 1.0f); img.texture = wep.ammoUI; }