Time for action – creating the enemy
We will need to import and do a little setup on a second tank, before we can do any AI type programming:
Select
Tanks_Type03.png
andTanks_Type03.blend
from the starting assets for the chapter and import them to theTanks
folder under theModels
folder.Once Unity has finished importing, select the new tank in the Project window and take a look at it in the Inspector window.
This tank has no animations, so the Animation Type can be set to None and Import Animation can be unchecked from the Rig and Animations pages respectively.
Drag the tank from the Project window to the Scene window; any clear patch of street will work just fine.
For starters, rename the model in the Scene view to
EnemyTank
.Now, we need to change the parenting of the tank so the turret can turn and the cannon will follow, just as we did for the player's tank. To do that, create an empty GameObject and rename it to
TurretPivot
.Position
TurretPivot
to be at the base of the turret.In the Hierarchy...