x


What would be the best way to setup Target priority

Right now i'm messing around with AI and i want them to go through a enemies in a certain order. What would be the best way to set it up? (in C# if it makes any differents)

more ▼

asked Apr 17 '12 at 12:45 PM

Sinperhezine gravatar image

Sinperhezine
13 4 6 13

Can you give a bit more information on what you are trying to do? There are as much AI algorithms as developpers in the world.

Are you using the NavMesh agent? Your own implementation of some AI algorithm?

Apr 17 '12 at 04:12 PM Kryptos

I am using simplePath to the control the movement of the AI

Apr 17 '12 at 04:43 PM Sinperhezine

In this case, it is related to this package. Ask the author http://forum.unity3d.com/members/44725-alexkring.

Apr 18 '12 at 07:58 AM Kryptos
(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

I had a targetting system in my spaceship game and what I did was to put all the "enemy" tagged gameobjects into a gameobject array and when player presses target next or target closest button (this is to make sure they get targetted if you instantiate some enemies from a spawner object at some point in the game) it cycles to the next target or the closest target from this array.

Like this:

var enemies : GameObject[] = GameObject.FindGameObjectsWithTag ("Enemy") as GameObject[];

I used the exact same logic in the AI but instead I set it to find the "friendly" tagged objects.

Hope this helps you.

more ▼

answered Apr 18 '12 at 11:51 AM

crocodile5 gravatar image

crocodile5
51 4 8 10

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x957
x75
x18

asked: Apr 17 '12 at 12:45 PM

Seen: 581 times

Last Updated: Apr 18 '12 at 11:51 AM