Game Development Reference
In-Depth Information
The move action
The move action is nearly identical to the idle action and uses the blackboard as a tempor-
ary data storage location for action-specific knowledge, and then removes the data once the
action terminates by setting the moveEndTime attribute to nil :
SoldierActions.lua :
function SoldierActions_MoveToCleanUp(userData)
userData.blackboard:Set("moveEndTime", nil);
end
function SoldierActions_MoveToInitialize(userData)
userData.controller:QueueCommand(
userData.agent,
SoldierController.Commands.MOVE);
local sandboxTimeInMillis =
Sandbox.GetTimeInMillis(userData.agent:GetSandbox());
userData.blackboard:Set(
"moveEndTime", sandboxTimeInMillis + 500);
return Action.Status.RUNNING;
end
function SoldierActions_MoveToUpdate(
deltaTimeInMillis, userData)
local sandboxTimeInMillis =
Sandbox.GetTimeInMillis(userData.agent:GetSandbox());
if (sandboxTimeInMillis >=
userData.blackboard:Get("moveEndTime")) then
userData.blackboard:Set("moveEndTime", nil);
return Action.Status.TERMINATED;
end
...
Search WWH ::




Custom Search