void Update() { if (container.Selected() == null) { return; } if (container.ShootAttempt() && Time.time > nextHit) { if (!container.Selected().canAttack(player, container)) { return; } nextHit = Time.time + container.Selected().rate; StartCoroutine(container.Selected().Effect()); container.Selected().Attack(player, blood); container.UpdateSelected(); } if (Input.GetKeyDown(KeyCode.R)) { RangedWeapon rangedWeapon = container.Selected() as RangedWeapon; if (rangedWeapon != null) { rangedWeapon.TryReload(player, container); } } }
public IEnumerator Reload(Actor a, WeaponContainer container) { container.Lock(); PlayReload(); a.Animator().SetBool("Reloading", true); yield return(reloadWait); magazineFill = magazineSize; container.UpdateSelected(); reloading = false; container.Unlock(); a.Animator().SetBool("Reloading", false); }