本文整理汇总了Python中direct.fsm.ClassicFSM.ClassicFSM类的典型用法代码示例。如果您正苦于以下问题:Python ClassicFSM类的具体用法?Python ClassicFSM怎么用?Python ClassicFSM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClassicFSM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, loader, parentFSM, doneEvent):
Place.Place.__init__(self, loader, doneEvent)
self.fsm = ClassicFSM('Playground', [State('start', self.enterStart, self.exitStart, ['walk',
'teleportIn',
'tunnelOut',
'doorOut']),
State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk', 'acknowledgeDeath']),
State('walk', self.enterWalk, self.exitWalk, ['teleportOut',
'stop',
'shtickerBook',
'died',
'tunnelIn']),
State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'stop']),
State('stop', self.enterStop, self.exitStop, ['walk',
'died',
'station',
'teleportOut',
'doorIn']),
State('shtickerBook', self.enterShtickerBook, self.exitShtickerBook, ['teleportOut', 'walk']),
State('tunnelOut', self.enterTunnelOut, self.exitTeleportOut, ['walk']),
State('final', self.enterFinal, self.exitFinal, ['start']),
State('died', self.enterDied, self.exitDied, ['final']),
State('station', self.enterStation, self.exitStation, ['teleportOut', 'walk']),
State('doorIn', self.enterDoorIn, self.exitDoorIn, ['stop']),
State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['stop']),
State('acknowledgeDeath', self.enterAcknowledgeDeath, self.exitAcknowledgeDeath, ['walk'])], 'start', 'final')
self.parentFSM = parentFSM
示例2: __init__
def __init__(self, book, parentFSM):
self.book = book
self.parentFSM = parentFSM
StateData.__init__(self, 'optionPageDone')
self.fsm = ClassicFSM('OptionPage', [State('off', self.enterOff, self.exitOff), State('basePage', self.enterBasePage, self.exitBasePage), State('displayPage', self.enterDisplayPage, self.exitDisplayPage)], 'off', 'off')
self.fsm.enterInitialState()
self.parentFSM.getStateNamed('optionPage').addChild(self.fsm)
示例3: __init__
def __init__(self, cr):
try:
self.DistributedRaceGame_initialized
return
except:
self.DistributedRaceGame_initialized = 1
DistributedMinigame.DistributedMinigame.__init__(self, cr)
self.movement = RaceGameMovement.RaceGameMovement(base.localAvatar)
self.skyUtil = SkyUtil()
self.raceFSM = ClassicFSM('DistributedRaceGame', [State('race', self.enterRace, self.exitRace), State('raceTransition', self.enterRaceTransition, self.exitRaceTransition), State('off', self.enterRaceOff, self.exitRaceOff)], 'off', 'off')
self.raceFSM.enterInitialState()
self.cr = cr
self.track = None
self.sky = None
self.countSfx = base.loadSfx('phase_5/audio/sfx/firehydrant_popup.mp3')
self.goSfx = base.loadSfx('phase_4/audio/sfx/AA_sound_whistle.mp3')
self.game = CIGlobals.RaceGame
self.trackPath = 'phase_4/models/minigames/sprint_track.egg'
self.skyPath = 'phase_3.5/models/props/TT_sky.bam'
self.lanePos = [(-22.0, -205.0, 0.0),
(-11.66, -205.0, 0.0),
(0.0, -205.0, 0.0),
(-33.66, -205.0, 0.0)]
self.initialCamPos = {'pos': (41.1, -145.0, 25.88),
'hpr': (135.0, 345.96, 0.0)}
self.raceCamPos = (-24.52, -37.22, 25.0)
self.lane = 0
return
示例4: __init__
def __init__(self, doneEvent, moveOn = 1):
StateData.__init__(self, doneEvent)
self.fsm = ClassicFSM('quietZone', [State('off', self.enterOff, self.exitOff, ['waitForQuietZoneResponse']),
State('waitForQuietZoneResponse', self.enterWaitForQuietZoneResponse, self.exitWaitForQuietZoneResponse, ['waitForSetZoneResponse']),
State('waitForSetZoneResponse', self.enterWaitForSetZoneResponse, self.exitWaitForSetZoneResponse, ['waitForSetZoneComplete']),
State('waitForSetZoneComplete', self.enterWaitForSetZoneComplete, self.exitWaitForSetZoneComplete, ['off'])], 'off', 'off')
self.fsm.enterInitialState()
self.moveOn = moveOn
示例5: __init__
def __init__(self, suit):
self.suit = suit
self.panicHP = self.suit.getMaxHealth() * self.PANIC_HP_FACTOR
self.fsm = ClassicFSM('CogBrain', [State('off', self.enterOff, self.exitOff),
State('neutral', self.enterNeutral, self.exitNeutral),
State('followBoss', self.enterFollowBoss, self.exitFollowBoss),
State('panic', self.enterPanic, self.exitPanic),
State('runAway', self.enterRunAway, self.exitRunAway)], 'off', 'off')
self.fsm.enterInitialState()
示例6: ToonInterior
class ToonInterior(Place.Place):
notify = directNotify.newCategory('ToonInterior')
def __init__(self, hood, parentFSM, doneEvent):
self.parentFSM = parentFSM
Place.Place.__init__(self, hood, doneEvent)
self.fsm = ClassicFSM('ToonInterior', [State('start', self.enterStart, self.exitStart, ['doorOut', 'teleportIn']),
State('walk', self.enterWalk, self.exitWalk, ['stop',
'doorIn',
'shtickerBook',
'teleportOut']),
State('shtickerBook', self.enterShtickerBook, self.exitShtickerBook, ['teleportOut', 'walk']),
State('teleportOut', self.enterTeleportOut, self.exitTeleportOut, ['teleportIn', 'stop']),
State('teleportIn', self.enterTeleportIn, self.exitTeleportIn, ['walk', 'stop']),
State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut, ['walk']),
State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['stop']),
State('stop', self.enterStop, self.exitStop, ['walk',
'died',
'teleportOut',
'doorIn']),
State('doorIn', self.enterDoorIn, self.exitDoorIn, ['stop']),
State('doorOut', self.enterDoorOut, self.exitDoorOut, ['walk']),
State('final', self.enterFinal, self.exitFinal, ['final'])], 'start', 'final')
def enter(self, requestStatus):
Place.Place.enter(self)
self.fsm.enterInitialState()
base.playMusic(self.loader.interiorMusic, volume=0.8, looping=1)
self.fsm.request(requestStatus['how'], [requestStatus])
def exit(self):
self.loader.interiorMusic.stop()
Place.Place.exit(self)
def load(self):
Place.Place.load(self)
self.parentFSM.getStateNamed('toonInterior').addChild(self.fsm)
def unload(self):
self.parentFSM.getStateNamed('toonInterior').removeChild(self.fsm)
del self.fsm
del self.parentFSM
self.ignoreAll()
Place.Place.unload(self)
示例7: __init__
def __init__(self, book, parentFSM):
self.book = book
self.parentFSM = parentFSM
StateData.__init__(self, 'adminPageDone')
self.fsm = ClassicFSM('AdminPage', [State('off', self.enterOff, self.exitOff),
State('basePage', self.enterBasePage, self.exitBasePage),
State('kickSection', self.enterKickSection, self.exitKickSection),
State('sysMsgSection', self.enterSysMsgSection, self.exitSysMsgSection)], 'off', 'off')
self.fsm.enterInitialState()
self.parentFSM.getStateNamed('adminPage').addChild(self.fsm)
示例8: __init__
def __init__(self, parentFSM, doneEvent, dnaStore, hoodId):
Hood.Hood.__init__(self, parentFSM, doneEvent, dnaStore, hoodId)
self.safeZoneLoader = None
self.townLoader = None
self.fsm = ClassicFSM('Hood', [State('off', self.enterOff, self.exitOff),
State('safeZoneLoader', self.enterSafeZoneLoader, self.exitSafeZoneLoader, ['quietZone', 'townLoader']),
State('townLoader', self.enterTownLoader, self.exitTownLoader, ['quietZone', 'safeZoneLoader']),
State('quietZone', self.enterQuietZone, self.exitQuietZone, ['safeZoneLoader', 'townLoader'])], 'off', 'off')
self.fsm.enterInitialState()
return
示例9: __init__
def __init__(self, avatar):
DirectObject.__init__(self)
self.avatar = avatar
self.power = self.MINIMUM_POWER
self.boost = 0.0
self.fsm = ClassicFSM('RaceGameMovement', [State('off', self.enterOff, self.exitOff, ['run']),
State('run', self.enterRun, self.exitRun, ['fall', 'off']),
State('fall', self.enterFall, self.exitFall, ['run', 'off']),
State('final', self.enterFinal, self.exitFinal)], 'off', 'final')
self.fsm.enterInitialState()
self.boostFSM = ClassicFSM('Boost', [State('off', self.enterBoostOff, self.exitBoostOff, ['boost']), State('boost', self.enterBoost, self.exitBoost)], 'off', 'off')
self.boostFSM.enterInitialState()
self.keysPressed = {'arrow_left': 0,
'arrow_right': 0}
self.startTime = 0.0
self.endTime = 0.0
self.fallTrack = None
self.isStopped = True
self.isBoosting = False
return
示例10: __init__
def __init__(self, parentFSM):
StateData.__init__(self, 'avChooseDone')
self.avChooseFSM = ClassicFSM('avChoose', [State('getToonData', self.enterGetToonData, self.exitGetToonData),
State('avChoose', self.enterAvChoose, self.exitAvChoose),
State('waitForToonDelResponse', self.enterWaitForToonDelResponse, self.exitWaitForToonDelResponse),
State('off', self.enterOff, self.exitOff)], 'off', 'off')
self.avChooseFSM.enterInitialState()
self.parentFSM = parentFSM
self.parentFSM.getStateNamed('avChoose').addChild(self.avChooseFSM)
self.pickAToon = None
self.setAvatarsNone()
return
示例11: __init__
def __init__(self, mg, cr, avId, gunName = 'pistol'):
RemoteAvatar.__init__(self, mg, cr, avId)
self.track = None
self.gunName = gunName
self.fsm = ClassicFSM('RemoteToonBattleAvatar', [State('off', self.enterOff, self.exitOff),
State('shoot', self.enterShoot, self.exitShoot),
State('die', self.enterDie, self.exitDie),
State('dead', self.enterDead, self.exitDead)], 'off', 'off')
self.fsm.enterInitialState()
self.soundGrunt = None
self.retrieveAvatar()
return
示例12: __init__
def __init__(self, hood, parentFSMState, doneEvent):
self.hood = hood
self.parentFSMState = parentFSMState
StateData.__init__(self, doneEvent)
self.fsm = ClassicFSM('TownLoader', [State('start', self.enterStart, self.exitStart, ['quietZone', 'street']),
State('street', self.enterStreet, self.exitStreet, ['quietZone']),
State('toonInterior', self.enterToonInterior, self.exitToonInterior, ['quietZone']),
State('quietZone', self.enterQuietZone, self.exitQuietZone, ['street', 'toonInterior']),
State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')
self.branchZone = None
self.canonicalBranchZone = None
self.placeDoneEvent = 'placeDone'
self.linkTunnels = []
return
示例13: __init__
def __init__(self, mg, weaponName = 'pistol'):
self.mg = mg
self.weaponName = weaponName
self.v_model_root = None
self.v_model = None
self.weapon = None
self.track = None
self.draw = None
self.shoot = None
self.reload = None
self.empty = None
self.cockBack = None
self.cockFwd = None
self.player_node = None
self.shooterTrav = None
self.shooterRay = None
self.shooterRayNode = None
self.shooterHandler = None
self.gui = ToonFPSGui(self)
self.fsm = ClassicFSM('ToonFPS', [State('off', self.enterOff, self.exitOff), State('alive', self.enterAlive, self.exitAlive), State('dead', self.enterDead, self.exitDead)], 'off', 'off')
self.aliveFSM = ClassicFSM('alive', [State('off', self.enterOff, self.exitOff),
State('draw', self.enterDraw, self.exitDraw, ['idle']),
State('idle', self.enterIdle, self.exitIdle, ['shoot', 'reload']),
State('shoot', self.enterShoot, self.exitShoot, ['idle']),
State('reload', self.enterReload, self.exitReload, ['idle'])], 'off', 'off')
self.fsm.getStateNamed('alive').addChild(self.aliveFSM)
self.fsm.enterInitialState()
self.aliveFSM.enterInitialState()
if self.weaponName == 'pistol':
self.ammo = 14
elif self.weaponName == 'shotgun':
self.ammo = 7
self.hp = 125
self.max_hp = 125
self.firstPerson = FirstPerson()
return
示例14: __init__
def __init__(self, playground):
self.playground = playground
self.fsm = ClassicFSM('BRWater', [State('off', self.enterOff, self.exitOff),
State('freezeUp', self.enterFreezeUp, self.exitFreezeUp),
State('coolDown', self.enterCoolDown, self.exitCoolDown),
State('frozen', self.enterFrozen, self.exitFrozen)], 'off', 'off')
self.fsm.enterInitialState()
self.freezeUpSfx = base.loadSfx('phase_8/audio/sfx/freeze_up.mp3')
self.frozenSfxArray = [base.loadSfx('phase_8/audio/sfx/frozen_1.mp3'), base.loadSfx('phase_8/audio/sfx/frozen_2.mp3'), base.loadSfx('phase_8/audio/sfx/frozen_3.mp3')]
self.coolSfxArray = [base.loadSfx('phase_8/audio/sfx/cool_down_1.mp3'), base.loadSfx('phase_8/audio/sfx/cool_down_2.mp3')]
self.freezeUpSfx.setVolume(12)
for sfx in self.frozenSfxArray:
sfx.setVolume(12)
for sfx in self.coolSfxArray:
sfx.setVolume(12)
示例15: __init__
def __init__(self, parentFSM, doneEvent):
self.parentFSM = parentFSM
StateData.__init__(self, doneEvent)
self.fsm = ClassicFSM('ShtickerBook', [State('off', self.enterOff, self.exitOff),
State('optionPage', self.enterOptionPage, self.exitOptionPage, ['districtPage', 'off']),
State('districtPage', self.enterDistrictPage, self.exitDistrictPage, ['optionPage', 'questPage', 'off']),
State('questPage', self.enterQuestPage, self.exitQuestPage, ['inventoryPage', 'districtPage', 'off']),
State('inventoryPage', self.enterInventoryPage, self.exitInventoryPage, ['mapPage', 'questPage', 'off']),
State('mapPage', self.enterMapPage, self.exitMapPage, ['releaseNotesPage', 'inventoryPage', 'off']),
State('releaseNotesPage', self.enterReleaseNotesPage, self.exitReleaseNotesPage, ['mapPage', 'off']),
State('adminPage', self.enterAdminPage, self.exitAdminPage, ['releaseNotesPage', 'off'])], 'off', 'off')
if base.localAvatar.getAdminToken() > -1:
self.fsm.getStateNamed('releaseNotesPage').addTransition('adminPage')
self.fsm.enterInitialState()
self.entered = 0
self.parentFSM.getStateNamed('shtickerBook').addChild(self.fsm)