public override void BeforeExecution() { Debug.Log("Shooting"); isCurrentState = true; animationFinished = false; if (weapons.primarySlot.CurrentlyEquipped?.GetType() == typeof(RangedWeapon)) { weapon = (RangedWeapon)weapons.primarySlot.CurrentlyEquipped; } else if (weapons.secondarySlot.CurrentlyEquipped?.GetType() == typeof(RangedWeapon)) { weapon = (RangedWeapon)weapons.secondarySlot.CurrentlyEquipped; } anim.SetBool(animationHash, true); self.SetHorizontalVelocity(Vector3.zero); if (weapon != null) { weapon.RangedAttack(controller.Aim); } }