base.py 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # coding: utf-8
  2. import tmx
  3. from sandbox.tile.simulation.physics import TerrainTile
  4. from sandbox.tile.simulation.physics import TileMoveCostComputer
  5. from synergine2.config import Config
  6. from synergine2_xyz.map import TMXMap
  7. from synergine2_xyz.physics import Physics
  8. from synergine2_xyz.physics import TMXPhysics
  9. from synergine2_xyz.simulation import XYZSimulation
  10. from synergine2_xyz.subjects import XYZSubjects
  11. from synergine2_xyz.subjects import XYZSubject
  12. class TileMap(TMXMap):
  13. xyz_tile_class = TerrainTile
  14. def get_default_tileset(self) -> tmx.Tileset:
  15. return self.tmx_tilesets['terrain']
  16. class TilePhysics(TMXPhysics):
  17. tmx_map_class = TileMap
  18. move_cost_computer_class = TileMoveCostComputer
  19. class TileStrategySimulation(XYZSimulation):
  20. behaviours_classes = [
  21. ]
  22. def __init__(
  23. self,
  24. config: Config,
  25. map_file_path: str,
  26. ) -> None:
  27. self.map_file_path = map_file_path
  28. super().__init__(config)
  29. def create_physics(self) -> Physics:
  30. return TilePhysics(
  31. config=self.config,
  32. map_file_path=self.map_file_path,
  33. )
  34. class TileStrategySubjects(XYZSubjects):
  35. pass
  36. class BaseSubject(XYZSubject):
  37. pass