Game Development Reference
In-Depth Information
Creating Vehicle Commands
Next, we have to create the class that will hold the commands for our tank vehicle to execute.
First, we will have to define a couple of enumerations.
The AIVehicleCommand enumeration (see Listing 8-11) holds the actual command type for the vehicle
to execute.
Listing 8-11. The Vehicle Command
enum AIVehicleCommand
{
None,
Patrol,
};
The vehicle commands can be
None : Specifies that there is no command
Patrol : Tells the tank to move toward the waypoints specified in the
VehicleCommand class object and at the same time fire at the player's
power pyramid
The AIVehicleObjectsAffected enumeration (see Listing 8-12) holds the item that is affected by the
command, such as
None : Indicates that there are no objects affected by the command.
WayPoints : Indicates that the waypoints will be affected by the command.
PrimaryWeapon : Indicates that the primary weapon will be used.
SecondaryWeapon : Indicates that the secondary weapon will be used.
Listing 8-12. Objects Affected by the Command
enum AIVehicleObjectsAffected
{
None,
WayPoints,
PrimaryWeapon,
SecondaryWeapon
};
The VehicleCommand class represents the command that we will send to the tank.
The m_Command variable holds the actual vehicle command in the form of an AIVehicleCommand
enumeration, mentioned previously.
private AIVehicleCommand m_Command;
 
Search WWH ::




Custom Search