private void Update() { if (CurrentTarget == null || !InRange || !(nextAttackPossible < Time.time)) { return; } if (CurrentTarget.IsDead()) { CurrentTarget = null; return; } if (!IsInLineOfSight(CurrentTarget.gameObject)) { status.DisplayText("No Line of Sight"); return; } Shoot(); nextAttackPossible = Time.time + AttackInterval; }