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
|
- **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
|
### Changed
|
||||||
|
|
||||||
- **world:** automatize world integration in a scene
|
- **world:** automatize world integration in a scene
|
||||||
|
|
|
@ -42,7 +42,8 @@ function MenuSystem:new(scene)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
self.menus = {}
|
self.menus = {}
|
||||||
self.focusedMenu = ""
|
self.focusedMenu = ""
|
||||||
self.isActive = true
|
self.isActive = true
|
||||||
|
self.lockWorld = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function MenuSystem:reset()
|
function MenuSystem:reset()
|
||||||
|
@ -54,16 +55,30 @@ end
|
||||||
|
|
||||||
function MenuSystem:activate()
|
function MenuSystem:activate()
|
||||||
self.isActive = true
|
self.isActive = true
|
||||||
|
if (self.lockWorld) then
|
||||||
|
if (self.scene.world ~= nil) then
|
||||||
|
self.scene.world:setActivity(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function MenuSystem:deactivate()
|
function MenuSystem:deactivate()
|
||||||
self.isActive = false
|
self.isActive = false
|
||||||
|
if (self.lockWorld) then
|
||||||
|
if (self.scene.world ~= nil) then
|
||||||
|
self.scene.world:setActivity(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function MenuSystem:getActiveState()
|
function MenuSystem:getActiveState()
|
||||||
return self.isActive
|
return self.isActive
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MenuSystem:lockWorldWhenActive(state)
|
||||||
|
self.lockWorld = state
|
||||||
|
end
|
||||||
|
|
||||||
-- MENUS FUNCTIONS
|
-- MENUS FUNCTIONS
|
||||||
-- Controle the menus of the menusystem
|
-- Controle the menus of the menusystem
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue