private void Update() { if (target == null) { return; } if (isHoming && target.GetIsAlive()) { transform.LookAt(GetAimPosition()); } transform.Translate(Vector3.forward * Time.deltaTime * projectileSpeed); }
public bool CanAttack(GameObject combatTarget) { if (combatTarget == null) { return(false); } Health targetToTest = combatTarget.GetComponent <Health>(); return(targetToTest != null && targetToTest.GetIsAlive()); }
private void Update() { timeElapsed += Time.deltaTime; if (target == null) { return; } if (!target.GetIsAlive()) { return; } if (!GetIsInRange()) { GetComponent <Mover>().MoveTo(target.transform.position, 1f); } else { GetComponent <Mover>().Cancel(); AttackBehaviour(); } }