base.py 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # coding: utf-8
  2. from opencc.const import COLLECTION_ALIVE
  3. from opencc.simulation.physics import TilePhysics
  4. from synergine2.config import Config
  5. from synergine2.simulation import SubjectBehaviour
  6. from synergine2_xyz.physics import Physics
  7. from synergine2_xyz.simulation import XYZSimulation
  8. from synergine2_xyz.subjects import XYZSubject
  9. from synergine2_xyz.subjects import XYZSubjects
  10. class TileStrategySimulation(XYZSimulation):
  11. behaviours_classes = [
  12. ]
  13. def __init__(
  14. self,
  15. config: Config,
  16. map_file_path: str,
  17. ) -> None:
  18. self.map_file_path = map_file_path
  19. super().__init__(config)
  20. def create_physics(self) -> Physics:
  21. return TilePhysics(
  22. config=self.config,
  23. map_file_path=self.map_file_path,
  24. )
  25. class TileStrategySubjects(XYZSubjects):
  26. pass
  27. class BaseSubject(XYZSubject):
  28. pass
  29. class AliveSubjectBehaviour(SubjectBehaviour):
  30. def is_terminated(self) -> bool:
  31. return COLLECTION_ALIVE not in self.subject.collections