Game Development Reference
In-Depth Information
Assigning member functions
Now that we have local implementations of functions, we need to assign them to each in-
stance of a soldier controller. Exposing these functions allows for an object-oriented way of
manipulating the solder controller from our agent Lua scripts:
SoldierController.lua :
function SoldierController.new(agent, soldier, weapon)
...
-- The SoldierController's accessor functions.
controller.ClearCommands =
SoldierController.ClearCommands;
controller.CurrentCommand =
SoldierController.CurrentCommand;
controller.ImmediateCommand =
SoldierController.ImmediateCommand;
controller.QueueCommand = SoldierController.QueueCommand;
controller.Update = SoldierController.Update;
SoldierController.Initialize(
controller, agent, soldier, weapon);
return controller;
end
Search WWH ::




Custom Search