mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 02:25:54 +00:00
Tweaked turret AI
This commit is contained in:
parent
dc55fa97d3
commit
a8c493c27a
4 changed files with 77 additions and 58 deletions
|
|
@ -60,10 +60,9 @@ public partial class EnemyTurretRotationMovement : MovementHandler
|
|||
switch (_actorAi.State)
|
||||
{
|
||||
case EnemyState.Idle:
|
||||
if (_playerDetection != null && IsPlayerInSight)
|
||||
if (_playerDetection != null && IsPlayerInRange && IsPlayerInSight)
|
||||
{
|
||||
_actorAi.State = EnemyState.Alert;
|
||||
GD.Print("Switching to alert");
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -75,10 +74,14 @@ public partial class EnemyTurretRotationMovement : MovementHandler
|
|||
_lastPlayerPosition = _playerDetection.CachedPlayer.GlobalPosition;
|
||||
}
|
||||
|
||||
if (IsPlayerInSight)
|
||||
if (IsPlayerInRange && IsPlayerInSight)
|
||||
{
|
||||
Shoot();
|
||||
}
|
||||
else
|
||||
{
|
||||
_actorAi.State = EnemyState.Idle;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue