import pymunk.pygame_util
from .base import BaseScene
+from ..battery import BatteryManager
from ..lights import LightManager, light_fitting_by_type
from ..obstacles import ObstacleManager
from ..events import SceneChangeEvent
self._toolbar_font = loader.load_font(FONTS['sans'], size=20)
self._obstacles = ObstacleManager(self._space, gamestate)
self._lights = LightManager(self._space, gamestate)
+ self._battery = BatteryManager(gamestate)
self._turnips = []
self._seeds = gamestate.seeds
self._harvested = gamestate.harvested
turnip_data = [turnip.serialize() for turnip in self._turnips]
gamestate.turnips = turnip_data
+ def end_day(self, gamestate):
+ self._battery.apply_recharge()
+ from .night import NightScene
+ SceneChangeEvent.post(scene=NightScene())
+
@debug_timer("day.render")
def render(self, surface, gamestate):
surface.blit(self._soil, (0, 0))
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())
elif ev.key == pgl.K_e:
- from .night import NightScene
- SceneChangeEvent.post(scene=NightScene())
+ self.end_day(gamestate)
elif ev.key == pgl.K_SPACE:
self._paused = not self._paused
elif ev.type == pgl.MOUSEBUTTONDOWN:
self._tool = None
self._clear_light_toolbar()
elif tool.name == 'start night':
- from .night import NightScene
- SceneChangeEvent.post(scene=NightScene())
+ self.end_day(gamestate)
elif tool.name == 'exit':
from .menu import MenuScene
SceneChangeEvent.post(scene=MenuScene())