def start(self): CogdoFlyingPlayer.start(self) self.toon.collisionsOff() self.flyerCollisions.setAvatar(self.toon) self.flyerCollisions.setCollisionsActive(1) self._levelBounds = self._level.getBounds() self.introGuiSeq.start() self.request('Running')
def exit(self): self.request('Inactive') CogdoFlyingPlayer.exit(self) self._cameraMgr.disable() self.flyerCollisions.setCollisionsActive(0) self.flyerCollisions.setAvatar(None) taskMgr.remove('delayedLandOnFuelPlatform') taskMgr.remove('delayedLandOnWinPlatform') self.ignoreAll()
def handleEnterGatherable(self, gatherable, elapsedTime): CogdoFlyingPlayer.handleEnterGatherable(self, gatherable, elapsedTime) if gatherable.type == Globals.Level.GatherableTypes.Memo: self.handleEnterMemo(gatherable) elif gatherable.type == Globals.Level.GatherableTypes.Propeller: self.handleEnterPropeller(gatherable) elif gatherable.type == Globals.Level.GatherableTypes.LaffPowerup: self.handleEnterLaffPowerup(gatherable) elif gatherable.type == Globals.Level.GatherableTypes.InvulPowerup: self.handleEnterInvulPowerup(gatherable)
def exit(self): self.request('Inactive') CogdoFlyingPlayer.exit(self) self._cameraMgr.disable() self.flyerCollisions.setCollisionsActive(0) self.flyerCollisions.setAvatar(None) taskMgr.remove('delayedLandOnFuelPlatform') taskMgr.remove('delayedLandOnWinPlatform') self.ignoreAll() return
def handleEnterGatherable(self, gatherable, elapsedTime): CogdoFlyingPlayer.handleEnterGatherable(self, gatherable, elapsedTime) if gatherable.type == Globals.Level.GatherableTypes.Memo: self.handleEnterMemo(gatherable) elif gatherable.type == Globals.Level.GatherableTypes.Propeller: self.handleEnterPropeller(gatherable) elif gatherable.type == Globals.Level.GatherableTypes.LaffPowerup: self._getLaffSfx.play() elif gatherable.type == Globals.Level.GatherableTypes.InvulPowerup: self._getRedTapeSfx.play() messenger.send(CogdoFlyingGuiManager.InvulnerableEventName)
def setBackpackState(self, state): if state == self.backpackState: return CogdoFlyingPlayer.setBackpackState(self, state) if state in Globals.Gameplay.BackpackStates: if state == Globals.Gameplay.BackpackStates.Normal: messenger.send(CogdoFlyingGuiManager.ClearMessageDisplayEventName) elif state == Globals.Gameplay.BackpackStates.Targeted: messenger.send(CogdoFlyingGuiManager.EagleTargetingLocalPlayerEventName) elif state == Globals.Gameplay.BackpackStates.Attacked: messenger.send(CogdoFlyingGuiManager.EagleAttackingLocalPlayerEventName)
def unload(self): self.toon.showName() self.toon.collisionsOn() self._destroyEventIval() self._destroyEnemyHitIval() CogdoFlyingPlayer.unload(self) self._fanSfx.stop() self.flyerCollisions.deleteCollisions() del self.flyerCollisions self.ignoreAll() taskMgr.remove('delayedLandOnPlatform') taskMgr.remove('delayedLandOnWinPlatform') self.checkpointPlatform = None self._cameraMgr.disable() del self._cameraMgr del self.game self._inputMgr.destroy() del self._inputMgr self.introGuiSeq.clearToInitial() del self.introGuiSeq if self.goSadSequence: self.goSadSequence.clearToInitial() del self.goSadSequence if self.coolDownAfterHitInterval: self.coolDownAfterHitInterval.clearToInitial() del self.coolDownAfterHitInterval if self.deathInterval: self.deathInterval.clearToInitial() del self.deathInterval if self.spawnInterval: self.spawnInterval.clearToInitial() del self.spawnInterval if self.outOfTimeInterval: self.outOfTimeInterval.clearToInitial() del self.outOfTimeInterval if self.winInterval: self.winInterval.clearToInitial() del self.winInterval if self.waitingForWinInterval: self.waitingForWinInterval.clearToInitial() del self.waitingForWinInterval if self.waitingForWinSeq: self.waitingForWinSeq.clearToInitial() del self.waitingForWinSeq del self.activeFans[:] del self.fansStillHavingEffect[:] self.fanIndex2ToonVelocity.clear() self.orthoWalk.stop() self.orthoWalk.destroy() del self.orthoWalk self.destroySfx() return
def resetToon(self, resetFuel = True): CogdoFlyingPlayer.resetToon(self) self.resetVelocities() del self.activeFans[:] del self.fansStillHavingEffect[:] self.fanIndex2ToonVelocity.clear() self._fanSfx.stop() spawnPos = self.checkpointPlatform.getSpawnPosForPlayer(self.getPlayerNumber(), render) self.activeWhirlwind = None self.toon.setPos(render, spawnPos) self.toon.setHpr(render, 0, 0, 0) if resetFuel: self.resetFuel() self.isHeadInCeiling = False self.isToonOnFloor = True
def resetToon(self, resetFuel = True): CogdoFlyingPlayer.resetToon(self) self.resetVelocities() del self.activeFans[:] del self.fansStillHavingEffect[:] self.fanIndex2ToonVelocity.clear() self._fanSfx.stop() spawnPos = self.checkpointPlatform.getSpawnPosForPlayer(self.getPlayerNumber(), render) self.activeWhirlwind = None self.toon.setPos(render, spawnPos) self.toon.setHpr(render, 0, 0, 0) if resetFuel: self.resetFuel() self.isHeadInCeiling = False self.isToonOnFloor = True return
def initPlayers(self): for toonId in self.distGame.getToonIds(): toon = self.distGame.getToon(toonId) i = self.distGame.getToonIds().index(toon.doId) if toon is not None: if toon.isLocal(): player = CogdoFlyingLocalPlayer(toon, self, self.level, self.guiMgr) self.localPlayer = player self.localPlayer.setPlayerNumber(i) else: player = CogdoFlyingPlayer(toon) player.enable() self._addPlayer(player) self.guiMgr.addToonToProgressMeter(toon)
def __init__(self, toon, game, level, guiMgr): CogdoFlyingPlayer.__init__(self, toon) self.defaultTransitions = {'Inactive': ['FreeFly', 'Running'], 'FreeFly': ['Inactive', 'OutOfTime', 'Death', 'FlyingUp', 'Running', 'HitWhileFlying', 'InWhirlwind'], 'FlyingUp': ['Inactive', 'OutOfTime', 'Death', 'FreeFly', 'Running', 'HitWhileFlying', 'InWhirlwind'], 'InWhirlwind': ['Inactive', 'OutOfTime', 'Death', 'FreeFly', 'HitWhileFlying'], 'HitWhileFlying': ['Inactive', 'OutOfTime', 'Death', 'FreeFly', 'InWhirlwind'], 'Death': ['Inactive', 'OutOfTime', 'Spawn'], 'Running': ['Inactive', 'OutOfTime', 'FreeFly', 'FlyingUp', 'Refuel', 'WaitingForWin', 'HitWhileRunning'], 'HitWhileRunning': ['Inactive', 'OutOfTime', 'Death', 'Running', 'FreeFly'], 'Spawn': ['Inactive', 'OutOfTime', 'Running', 'WaitingForWin'], 'OutOfTime': ['Inactive', 'Spawn'], 'WaitingForWin': ['Inactive', 'Win'], 'Win': ['Inactive']} self.game = game self._level = level self._guiMgr = guiMgr self._inputMgr = CogdoFlyingInputManager() self._cameraMgr = CogdoFlyingCameraManager(camera, render, self, self._level) self.velocity = Vec3(0.0, 0.0, 0.0) self.instantaneousVelocity = Vec3(0.0, 0.0, 0.0) self.controlVelocity = Vec3(0.0, 0.0, 0.0) self.fanVelocity = Vec3(0.0, 0.0, 0.0) self.activeFans = [] self.fansStillHavingEffect = [] self.fanIndex2ToonVelocity = {} self.legalEagleInterestRequest = {} self.activeWhirlwind = None self.oldPos = Vec3(0.0, 0.0, 0.0) self.checkpointPlatform = None self.isHeadInCeiling = False self.isToonOnFloor = False self.fuel = 0.0 self.score = 0 self.postSpawnState = 'Running' self.didTimeRunOut = False self.hasPressedCtrlYet = False self.hasPickedUpFirstPropeller = False self.surfacePoint = None self.legalEagleHitting = False self.propState = None self.broadcastPeriod = Globals.AI.BroadcastPeriod self.initSfx() self.initLocalPlayerIntervals() self.initCollisions() self.initOrthoWalker() self.playerNumber = -1 self.fuel = 0.0 self._guiMgr.setFuel(self.fuel) self.setCheckpointPlatform(self._level.startPlatform)
def handleDebuffPowerup(self, pickupType, elapsedTime): self._invulDebuffSfx.play() CogdoFlyingPlayer.handleDebuffPowerup(self, pickupType, elapsedTime) messenger.send(CogdoFlyingGuiManager.ClearMessageDisplayEventName)
def resetBlades(self): CogdoFlyingPlayer.resetBlades(self) self._guiMgr.resetBlades()
def disable(self): CogdoFlyingPlayer.disable(self)
def enable(self): CogdoFlyingPlayer.enable(self) self.toon.hideName()
def setBlades(self, fuelState): CogdoFlyingPlayer.setBlades(self, fuelState) self._guiMgr.setBlades(fuelState)
def bladeLost(self): CogdoFlyingPlayer.bladeLost(self) self._bladeBreakSfx.play(volume=0.35) self._guiMgr.bladeLost()