feat(menusystem): add a way to deactivate world when activating the menu
This commit is contained in:
parent
f7040d1854
commit
fb35eca0fa
2 changed files with 18 additions and 1 deletions
|
@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- **world:** Add `Actor.depth` to keep the order in which actors are drawn
|
||||
|
||||
- **menusystem;** Add a way to deactivate the menu when activating the world
|
||||
|
||||
### Changed
|
||||
|
||||
- **world:** automatize world integration in a scene
|
||||
|
|
|
@ -42,7 +42,8 @@ function MenuSystem:new(scene)
|
|||
self.scene = scene
|
||||
self.menus = {}
|
||||
self.focusedMenu = ""
|
||||
self.isActive = true
|
||||
self.isActive = true
|
||||
self.lockWorld = false
|
||||
end
|
||||
|
||||
function MenuSystem:reset()
|
||||
|
@ -54,16 +55,30 @@ end
|
|||
|
||||
function MenuSystem:activate()
|
||||
self.isActive = true
|
||||
if (self.lockWorld) then
|
||||
if (self.scene.world ~= nil) then
|
||||
self.scene.world: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
|
||||
end
|
||||
|
||||
function MenuSystem:getActiveState()
|
||||
return self.isActive
|
||||
end
|
||||
|
||||
function MenuSystem:lockWorldWhenActive(state)
|
||||
self.lockWorld = state
|
||||
end
|
||||
|
||||
-- MENUS FUNCTIONS
|
||||
-- Controle the menus of the menusystem
|
||||
|
||||
|
|
Loading…
Reference in a new issue