i’m working on enemy AI algorithm.
this is the result.
but there is a problem.
how can say to Unity that rear enemies stop trying to reach the player until near enemies are attacking the player?
they are stuck there because near enemies are attacking the player but they are trying to reach the player because of the navmesh so they are running. ( i want to stop them)
they should wait until near enemies finish attacking.
please help
Hi @mtGameDev,
Nice project… from my point of view, your issue could be solved in few steps…
(1) Try to imagine that around player we have 2/3 circle zones… First one - could be in mele atack area around player… so we could assign stoping distance for NavMesh etc… Second one - could be 2.0f -4.0f from player…
(2) Each of Enemys on spawn could have assigned some PlayerAttackListManager assigned, ofcourse inside we already have stored instance for Player Transform, so it will be easy to check his position. This script could have List for each of circle zone… and distribut passes for changing zones according to limit.
(Example) 1st zone have limit of 4 units, 2nd zone have limit of 8 units… some enemy units are spawned, and they at start “asking” PlayerAttackListManager how to “attack”… units 1-4 will be assigned to List for firs circle zone… so they need to informed to go directly till collide with player, and to their job… units 5-10 will be assigned to List for second circle, and will be ordered to stay in some distance from player (not closer than, not further then)…
Player manage to destroy one unit from first circle… PlayerAttackListManager .Remove enemy from second List and .Add it to first Quene…
Hope that this make any sense for you… Hope you will get the main idea