Game Development Reference
In-Depth Information
-- decision structure will simply repath if the Agent
needs
-- to move again.
local sandboxTimeInMillis =
Sandbox.GetTimeInMillis(userData.agent:GetSandbox());
if (sandboxTimeInMillis >= userData.moveEndTime) then
userData.moveEndTime = nil;
return Action.Status.TERMINATED;
end
path = userData.agent:GetPath();
if (#path ~= 0) then
offset = Vector.new(0, 0.05, 0);
DebugUtilities_DrawPath(
path, false, offset, DebugUtilities.Orange);
Core.DrawCircle(
path[#path] + offset, 1.5,
DebugUtilities.Orange);
end
-- Terminate movement is the Agent is close enough to
the
-- target.
if (Vector.Distance(userData.agent:GetPosition(),
userData.agent:GetTarget()) < 1.5) then
Agent.RemovePath(userData.agent);
return Action.Status.TERMINATED;
end
return Action.Status.RUNNING;
end
SoldierLogic.lua :
local function MoveAction(userData)
return Action.new(
"move",
Search WWH ::




Custom Search