123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import bge
-
- #====================================
-
- State = type("State", (object,), {})
- #====================================
- class State(object):
- def __init__(self, FSM):
- self.FSM = FSM
- self.timer = 0
- self.startTime = 0
- def Enter(self):
- self.timer = 0
- self.startTime = 0
- def Execute(self):
- print('Executing')
- def Exit(self):
- print('Exiting')
-
- #====================================
-
- class Example(State):
- def __init__(self,FSM):
- super(Example, self).__init__(FSM)
-
- def Enter(self):
- self.FSM.stateLife = 1
- super(Example, self).Enter()
-
- def Execute(self):
- self.FSM.stateLife += 1
- #self.FSM.ToTransition('toLand')
-
- def Exit(self):
- pass
-
- #====================================
-
- class Startup(State):
- def __init__(self,FSM):
- super(Startup, self).__init__(FSM)
-
- def Enter(self):
- self.FSM.stateLife = 1
- super(Startup, self).Enter()
-
- def Execute(self):
- self.FSM.stateLife += 1
-
- #if self.FSM.stateLife == 2:
- #Startup.main(self.FSM.owner['cont'])
-
- self.FSM.ToTransition('toWalk')
- print('player FSM')
-
- def Exit(self):
- pass
-
- #====================================
-
- class Walk(State):
- def __init__(self,FSM):
- super(Walk, self).__init__(FSM)
-
- def Enter(self):
- self.FSM.stateLife = 1
- super(Walk, self).Enter()
-
- def Execute(self):
- self.FSM.stateLife += 1
- #self.FSM.ToTransition('toLand')
-
- def Exit(self):
- pass
-
- #====================================
-
- class Roll(State):
- def __init__(self,FSM):
- super(Roll, self).__init__(FSM)
-
- def Enter(self):
- self.FSM.stateLife = 1
- super(Roll, self).Enter()
-
- def Execute(self):
- self.FSM.stateLife += 1
- #self.FSM.ToTransition('toLand')
-
- def Exit(self):
- pass
-
- #====================================
|