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:
Drag the EnemyPilot_Mech prefab into the scene
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:
Create a new game object
Add a Game Agent component and make sure Is Player is unchecked in the inspector
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:
If there's a target, the mech will engage in combat
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:
Open the inspector of the AI Controller component
Customize the Attack Time
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:
Create a new game object
Add a Combat Zone component
Adjust the Bounds in the inspector to cover the area in which the mech should operate during combat
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:
Create a new game object and add a Patrol Route component
Create new game objects for each waypoint and drag them into the Waypoints list in the inspector of the Patrol Route component
Drag the patrol route into the Patrol Route field in the inspector of the AI's AI Controller component
Last updated