1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
shard_include( "behaviour" )
BehaviourFactory = class(AIBase)
shard_include( "behaviours" )
function BehaviourFactory:Init()
--
end
function BehaviourFactory:AddBehaviours(unit)
if unit == nil then
return
end
-- add behaviours here
-- unit:AddBehaviour(behaviour)
local b = behaviours[unit:Internal():Name()]
if b == nil then
b = defaultBehaviours(unit)
end
for i,behaviour in ipairs(b) do
t = behaviour()
t:SetUnit(unit)
t:Init()
unit:AddBehaviour(t)
end
end
|