Line of sight for enemy
This commit is contained in:
@@ -21,6 +21,12 @@ namespace GameJamDungeon
|
||||
enemy.LookAt(new Vector3(gameRepo.PlayerGlobalPosition.Value.X, enemy.GlobalPosition.Y, gameRepo.PlayerGlobalPosition.Value.Z), Vector3.Up);
|
||||
return ToSelf();
|
||||
}
|
||||
|
||||
if (enemy.GlobalPosition.DistanceTo(gameRepo.PlayerGlobalPosition.Value) > 20f)
|
||||
{
|
||||
return To<Idle>();
|
||||
}
|
||||
|
||||
enemy.NavAgent.TargetPosition = gameRepo.PlayerGlobalPosition.Value;
|
||||
var nextPosition = enemy.NavAgent.GetNextPathPosition();
|
||||
var lookAtPos = enemy.NavAgent.GetNextPathPosition();
|
||||
|
||||
Reference in New Issue
Block a user