ColonyConfiguration.py 734B

1234567891011121314151617181920212223
  1. from synergine.synergy.collection.Configuration import Configuration
  2. from intelligine.synergy.object.ant.Ant import Ant
  3. from intelligine.cst import ALIVE, COLONY
  4. from xyzworld.cst import POSITION
  5. class ColonyConfiguration(Configuration):
  6. _start_position = (0, 20, 20)
  7. _ant_class = Ant
  8. _ant_count = 50
  9. def get_start_objects(self, collection, context):
  10. context.metas.value.set(POSITION, collection.get_id(), self._start_position)
  11. ants = []
  12. for i in range(self._ant_count):
  13. ant = self._ant_class(collection, context)
  14. context.metas.value.set(COLONY, ant.get_id(), collection.get_id())
  15. ant.set_position(self._start_position)
  16. ants.append(ant)
  17. return ants