feat(menusystem): add a function to deactivate assets when menu is active
This commit is contained in:
parent
a227bbb033
commit
b47e158126
1 changed files with 21 additions and 1 deletions
|
@ -44,6 +44,7 @@ function MenuSystem:new(scene)
|
|||
self.focusedMenu = ""
|
||||
self.isActive = true
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue