Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StatesTrain.py 880B

12345678910111213141516171819202122232425262728293031323334353637
  1. import bge
  2. import random
  3. #====================================
  4. State = type("State", (object,), {})
  5. #====================================
  6. class State(object):
  7. def __init__(self, FSM):
  8. self.FSM = FSM
  9. self.timer = 0
  10. self.startTime = 0
  11. def Enter(self):
  12. self.timer = 0
  13. self.startTime = 0
  14. def Execute(self):
  15. print('Executing')
  16. def Exit(self):
  17. print('Exiting')
  18. #====================================
  19. class Example(State):
  20. def __init__(self,FSM):
  21. super(Example, self).__init__(FSM)
  22. def Enter(self):
  23. self.FSM.stateLife = 1
  24. super(Example, self).Enter()
  25. def Execute(self):
  26. self.FSM.stateLife += 1
  27. #self.FSM.ToTransition('toLand')
  28. def Exit(self):
  29. pass
  30. #====================================