Game Development Reference
In-Depth Information
4. Drag the
AI
game object inside the
Enemy
game object in the
Hierarchy
view, and
then go to the
Prefabs
folder in the
Project
view. We will see the
robot_AI
prefab
object; drag it inside the
AI
game object, which is a child of the
Enemy
game object
in the
Hierarchy
view similar to the
Waypoints
game object, as shown in the
following screenshot:
We sill need one more thing inside our
AI
game object, which is the
RocketLauncher
.
This is basically a similar setup as for our player character; so go to the
First Person
Controller
game object, click on the arrow in front of it to bring down the
Main Camera
,
and then click on the arrow in front of the
Main Camera
. We will see the
RocketLauncher
game object, which we need for our enemy. Let's press
Ctrl + D
(in Windows) or
Command +
D
(on a Mac) to duplicate it, and then drag this duplicate
RocketLauncher
game object inside
the
AI
game object, as shown in the following screenshot:
If we take a look at the
Hierarchy
view of the
AI
game and the
Main Camera
game object,
we will see a similar structure. The only difference is that the
AI
game object has the
AIController
script and
CharacterController
atached to it as we can see in the
preceding screenshot.