AI - Mech Combat Kit

In the Mech Combat Kit, the EnemyPilot_Mech prefab has been provided to help you get started creating enemies for your game.

To use it:

  1. Drag the EnemyPilot_Mech prefab into the scene

  2. Open the Game Agent inspector and set the Starting Vehicle field to some mech that exists in the scene

Creating AI

To set up a new mech AI:

  1. Create a new game object

  2. Add a Game Agent component and make sure Is Player is unchecked in the inspector

  3. Add a new game object as a child and add an AI Controller component to it

AI Controller

The AI Controller is an AI script for mechs that provides two functions:

  1. If there's a target, the mech will engage in combat

  2. If there's no target, the mech will patrol

Field Of View

To restrict the AI's field of view so that they cannot see targets behind them, set the Field of View field in the inspector of the AI Controller component.

Combat Attack/Evade Times

During combat, the mech will alternate between attacking and evading (moving around without firing weapons). To adjust these:

  1. Open the inspector of the AI Controller component

  2. Customize the Attack Time

  3. Customize the Evade Time

Combat Zones

To help the mech avoid running into walls and other objects in the scene, the Combat Zone component has been provided.

This component designates an area in which a mech will move around while engaged in combat.

To set up a combat zone:

  1. Create a new game object

  2. Add a Combat Zone component

  3. Adjust the Bounds in the inspector to cover the area in which the mech should operate during combat

  4. Drag the combat zone into the Combat Zone field in the inspector of the mech AI's AI Controller component

Patrolling

When a mech AI has no targets, it will patrol along a patrol route, if you have one set up.

To set up a patrol route:

  1. Create a new game object and add a Patrol Route component

  2. Create new game objects for each waypoint and drag them into the Waypoints list in the inspector of the Patrol Route component

  3. Drag the patrol route into the Patrol Route field in the inspector of the AI's AI Controller component

Last updated