Soldier tactics
In order to manage multiple influence maps, we can create common initialize and update functions that wrap the update interval of different influence maps as well as the initial setup. As the SoldierTactics
initialize function will be responsible for the influence map's configuration and construction, we can move the previous initialization code from Sandbox.lua
:
SoldierTactics.lua
:
SoldierTactics = {}; SoldierTactics.InfluenceMap = {}; function SoldierTactics_InitializeTactics(sandbox) -- Override the default influence map configuration. local influenceMapConfig = { CellHeight = 1, CellWidth = 2, BoundaryMinOffset = Vector.new(0.18, 0, 0.35) }; -- Create the sandbox influence map. Sandbox.CreateInfluenceMap( sandbox, "default", influenceMapConfig); -- Initialize each layer of the influence map that has -- an initialization function. for key, value in pairs(SoldierTactics.InfluenceMap) do ...