gamecore/world: add an activity system for the world
This commit is contained in:
parent
e73d6804f5
commit
80ef8b1a65
2 changed files with 18 additions and 1 deletions
|
@ -64,7 +64,7 @@ function Scene:update(dt)
|
|||
end
|
||||
|
||||
function Scene:updateWorld(dt)
|
||||
if (self.world ~= nil) then
|
||||
if (self.world ~= nil) and (self.world.isActive) then
|
||||
self.world:update(dt)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,6 +44,8 @@ function BaseWorld:new(scene, actorlist, mapfile)
|
|||
self:setGravity()
|
||||
|
||||
self:register()
|
||||
|
||||
self.isActive = true
|
||||
end
|
||||
|
||||
function BaseWorld:setActorList(actorlist)
|
||||
|
@ -275,6 +277,21 @@ function BaseWorld:getBackgroundColor()
|
|||
return self.backcolor[1]/256, self.backcolor[2]/256, self.backcolor[3]/256
|
||||
end
|
||||
|
||||
-- Lock MANAGEMENT FUNCTIONS
|
||||
-- Basic function to handle the lock
|
||||
|
||||
function BaseWorld:setActivity(activity)
|
||||
self.isActive = activity
|
||||
end
|
||||
|
||||
function BaseWorld:switchActivity()
|
||||
self.isActive = (self.isActive == false)
|
||||
end
|
||||
|
||||
function BaseWorld:getActivity()
|
||||
return self.isActive
|
||||
end
|
||||
|
||||
-- UPDATE FUNCTIONS
|
||||
-- All update functions
|
||||
|
||||
|
|
Loading…
Reference in a new issue