Easy AI Manager

Easy AI Manager is a visual editor to create your own agent without code.

You can use the scripts of Easy AI with this manager and get the same results, faster and without code!.

Easy AI Manager works like a state machine, it use a Easy AI script when a condition happens it goes to next state.

To use this:

Add to a gameobject the script Easy AI Manager.

searching-easy-ai-manager-script

Now you see in the inspector, buttons with the names of the Easy AI scripts, if you click some button the agent will use that script.

easy-ai-manager-inspectorIf you click add you will see different buttons.

easy-ai-manager-conditionalsThat are the conditionals. The conditionals are the conditions that need to happen to go to the next state

If you click add, and your last line contains conditionals it will add a new line with actions

easy-ai-manager-add-after-conditionalsIf you click delete that line will be deleted.

easy-ai-manager-delete-conditionals

Some actions have options (these are displayed when you click the action):

Pursue:

  • ( GameObject ) Target: The gameObject that the agent is going to pursue

Shoot:

Each time that you activate the shoot button the pistol is created so when you modify any of the following variables desactivate and activate this button to create again the pistol with the new values, when you desactivate this button the pistol is deleted:

  • ( Enum )BulletType: [Bullet] If you want to shoot a bullet. [Raycast] If you want to shoot a invisible bullet.

  • ( GameObject ) Pistol: The pistol model.

  • ( float ) Pistol Damage: The damage that a bullet applies.

  • [Showed if bullet type = bullet]( GameObject ) Bullet: The bullet model.

  • [Showed if bullet type = bullet]( float ) ShootForce: The force that will be applied to the bullet.

  • (LayerMask) ShootableMask: The layer of gameobjects that the player can apply damage.

  • ( float ) Time Between Shoots: The time that the player have to wait to can shoot.

  • Optional Variables

  • (ParticleSystem) Muzzle Effect: The particle effect played on shoot.

  • (Light) Shoot Light: The light that is turned on during a few time when shoot.

  • (AudioClip) Shoot Audio: The audio played when shoot:

Evade:

  • ( GameObject ) Target: The gameObject that the agent is going to evade

Flee:

  • ( GameObject ) Target: The gameObject that the agent is going to flee from

Patrol:

If you click patrol, are created 4 waypoints in the scene, these four points are for which the agent is going to patrol.

easy-ai-manager-patrol-waypointsGoTo:

  • ( GameObject ) Target: The position that the agent is going to go

Let’s see a example:

easy-ai-manager-example-1Our Easy AI Manager interprets this simply as: Pursue to the player and when you listens to it flee from it.

Explanation of this example:

The first line (state 1) is the first action that will run .

The second line (condition 1) is the condition that need to happen to go from state 1 to state 2.

The third line (state 2) is the action that will run when the condition 1 is fullfilled.

If you press play the result will be the following:

The agent will pursue to the target (in this case the player is the target).

When the agent listens to the target the agent flees from the target.

Why we are getting this result?

1- Immediately the game starts it runs the state 1 (pursue to the target)

2- When the agent listens to the target the script goes from state 1 to state 2 (flee from the target)

Other option that you can choose is “Loop”. That is for when the last condition is fullfilled go to the first state and start again.

Here is a demonstration:

Select the parameter for:

easy-ai-manager-select-parameter-forThe animation that will be played on it action

Walk (When the player is walking will be played the walk animation).

Idle (When the player is still will be played the idle animation).

Shoot (When the player is shooting will be played the shoot animation).

Death (When the player is dead will be played the death animation).

Get Damage (When the player get a hit will be played the get damage animation).

in Easy AI C#