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.

StatesNpcPed.py 916B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import utils
  2. import bge
  3. State = type("State", (object,), {})
  4. #====================================
  5. class State(object):
  6. def __init__(self, FSM):
  7. self.FSM = FSM
  8. self.timer = 0
  9. self.startTime = 0
  10. def Enter(self):
  11. self.timer = 0
  12. self.startTime = 0
  13. def Execute(self):
  14. print('Executing')
  15. def Exit(self):
  16. print('Exiting')
  17. #====================================
  18. class Example(State):
  19. def __init__(self,FSM):
  20. super(Example, self).__init__(FSM)
  21. def Enter(self):
  22. self.FSM.stateLife = 1
  23. super(Example, self).Enter()
  24. def Execute(self):
  25. self.FSM.stateLife += 1
  26. #o = self.FSM.owner
  27. #g = o.me['game']
  28. #self.FSM.ToTransition('toNewState')
  29. #print('npc fsm')
  30. def Exit(self):
  31. pass
  32. #====================================