local StateMachineManager = {
	fsmList = {}
}

---- 添加一个状态机
function StateMachineManager:addStateMachine(fsm)
	for k, v in ipairs(self.fsmList) do
        if v == fsm then
            return
        end
    end
    table.insert(self.fsmList, fsm)
end

---- 移除一个状态机
function StateMachineManager:removeStateMachine(fsm)
    for index, value in ipairs(self.fsmList) do
        if fsm == value then
            fsm:stop()
            table.remove(self.fsmList, index)
            break
        end
    end
end

---- 每帧tick
function StateMachineManager:tick()
    for _, fsm in ipairs(self.fsmList) do
        if fsm:getIsActive() then
            fsm:tick()
        end
    end
end

return StateMachineManager