Game Development Reference
In-Depth Information
function SoldierTactics_UpdateTactics(sandbox,
deltaTimeInMillis)
-- Update each influence map layer if enough time has
passed,
-- specified by the layer.
for key, value in pairs(SoldierTactics.InfluenceMap) do
value.lastUpdate = value.lastUpdate +
deltaTimeInMillis;
if (value.lastUpdate > value.updateFrequency) then
value.updateFunction(
sandbox, value.layer, deltaTimeInMillis);
value.lastUpdate = 0;
end
end
end
For debugging purposes, we can also encapsulate drawing the influence map with specific
color values provided by the SoldierTactics implementation:
SoldierTactics.lua :
function SoldierTactics_DrawInfluenceMap(sandbox, layer)
Sandbox.DrawInfluenceMap(
sandbox,
layer,
{ 0, 0, 1, 0.9 },
{ 0, 0, 0, 0.75 },
{ 1, 0, 0, 0.9 });
end
Search WWH ::




Custom Search