feat(menusystem): add a function to deactivate assets when menu is active

This commit is contained in:
Kazhnuz 2019-06-16 16:36:39 +02:00
parent a227bbb033
commit b47e158126

View file

@ -43,7 +43,8 @@ function MenuSystem:new(scene)
self.menus = {}
self.focusedMenu = ""
self.isActive = true
self.lockWorld = false
self.lockWorld = false
self.lockAssets = false
end
function MenuSystem:reset()
@ -55,20 +56,34 @@ end
function MenuSystem:activate()
self.isActive = true
if (self.lockWorld) then
if (self.scene.world ~= nil) then
self.scene.world:setActivity(false)
end
end
if (self.lockAssets) then
if (self.scene.assets ~= nil) then
self.scene.assets:setActivity(false)
end
end
end
function MenuSystem:deactivate()
self.isActive = false
if (self.lockWorld) then
if (self.scene.world ~= nil) then
self.scene.world:setActivity(true)
end
end
if (self.lockAssets) then
if (self.scene.assets ~= nil) then
self.scene.assets:setActivity(true)
end
end
end
function MenuSystem:getActiveState()
@ -79,6 +94,11 @@ function MenuSystem:lockWorldWhenActive(state)
self.lockWorld = state
end
function MenuSystem:lockAssetsWhenActive(state)
self.lockAssets = state
end
-- MENUS FUNCTIONS
-- Controle the menus of the menusystem