Ability to Restart Level, Player Spawning and a Test Level added + Bug Fix
This commit is contained in:
@@ -21,7 +21,7 @@ namespace AI
|
||||
protected bool isShooting = false;
|
||||
protected IMovement movement = null;
|
||||
|
||||
protected bool canShoot => (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared && target != null;
|
||||
protected bool canShoot => target != null && (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared;
|
||||
|
||||
public UnityEvent OnShoot { get; protected set; } = null;
|
||||
|
||||
@@ -36,11 +36,13 @@ namespace AI
|
||||
cooldownPerShoot = 1f / attacksPerSecond;
|
||||
attackRangeSquared = attackRange * attackRange;
|
||||
OnShoot = new UnityEvent();
|
||||
UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform);
|
||||
}
|
||||
|
||||
protected virtual void Start()
|
||||
=> movement = transform.GetComponentInParent<IMovement>();
|
||||
{
|
||||
movement = transform.GetComponentInParent<IMovement>();
|
||||
UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform);
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
|
Reference in New Issue
Block a user