def unload(self): DistributedPartyTrampolineActivity.notify.debug('unload') if self.hopOnAnim and self.hopOnAnim.isPlaying(): self.hopOnAnim.finish() if self.hopOffAnim and self.hopOffAnim.isPlaying(): self.hopOffAnim.finish() if self.beginRoundInterval and self.beginRoundInterval.isPlaying(): self.beginRoundInterval.finish() if self.flashTextInterval and self.flashTextInterval.isPlaying(): self.flashTextInterval.finish() if self.heightTextInterval and self.heightTextInterval.isPlaying(): self.heightTextInterval.finish() self.timer.stop() DistributedPartyActivity.unload(self) taskMgr.remove(self.uniqueName('TrampolineActivity.updateTask')) taskMgr.remove(self.uniqueName('TrampolineActivity.remoteUpdateTask')) self.ignoreAll() del self.heightTextInterval del self.beginRoundInterval del self.hopOnAnim del self.hopOffAnim del self.flashTextInterval if hasattr(self, 'beanAnims'): self.cleanupJellyBeans() self.quitEarlyButton.destroy() del self.quitEarlyButton del self.gui del self.activityFSM del self.animFSM return
def __init__(self, cr): DistributedPartyActivity.__init__( self, cr, PartyGlobals.ActivityIds.PartyCatch, PartyGlobals.ActivityTypes.HostInitiated, wantRewardGui=True ) self.setUsesSmoothing() self.setUsesLookAround() self._sNumGen = SerialNumGen()
def setToonsPlaying(self, toonIds): self.notify.info("setToonsPlaying(%s)" % (toonIds,)) DistributedPartyActivity.setToonsPlaying(self, toonIds) if self.isLocalToonInActivity() and base.localAvatar.doId not in toonIds: if base.localAvatar.doId in self.toonSDs: self.takeLocalAvatarOutOfActivity() self.toonSDs[base.localAvatar.doId].fsm.request("notPlaying")
def unload(self): self.notify.debug('unload') DistributedPartyActivity.unload(self) if self.shadowNode is not None: self.shadowNode.removeNode() del self.shadowNode if self.splash is not None: self.splash.destroy() del self.splash if self.dustCloud is not None: self.dustCloud.destroy() del self.dustCloud del self.sndHitHouse del self.sndHitGround del self.sndHitWater del self.sndBounce1 del self.sndBounce2 del self.sndBounce3 if self.localFlyingToon: self.__resetToon(self.localFlyingToon) self.localFlyingToon.loop('neutral') self.localFlyingToon.setPlayRate(1.0, 'run') self.localFlyingToon = None self.ignoreAll() return
def unload(self): DistributedPartyCatchActivity.notify.debug("unload") self.finishAllDropIntervals() self.destroyOrthoWalk() DistributedPartyActivity.unload(self) self.stopDropTask() del self.activityFSM del self.__textGen for avId in self.toonSDs: if avId in self.toonSDs: toonSD = self.toonSDs[avId] toonSD.unload() del self.toonSDs self.treesAndFence.removeNode() del self.treesAndFence self.dropShadow.removeNode() del self.dropShadow base.cr.parentMgr.unregisterParent(self._avatarNodePathParentToken) for model in self.dropObjModels.values(): model.removeNode() del self.dropObjModels del self.sndGoodCatch del self.sndOof del self.sndAnvilLand del self.sndPerfect
def generate(self): DistributedPartyActivity.generate(self) self._doneCannons = False self._avId2trajectoryInfo = {} self._remoteToonFlyTaskName = 'remoteToonFlyTask-%s' % self.doId taskMgr.add(self._remoteToonFlyTask, self._remoteToonFlyTaskName, priority=45) self.d_cloudsColorRequest()
def generateInit(self): self.notify.debug('generateInit') DistributedPartyActivity.generateInit(self) self.keyCodes = KeyCodes(patterns=self.dancePatternToAnims.keys()) self.gui = KeyCodesGui(self.keyCodes) self.__initOrthoWalk() self.activityFSM = DanceActivityFSM(self)
def unload(self): DistributedPartyCatchActivity.notify.debug('unload') self.finishAllDropIntervals() self.destroyOrthoWalk() DistributedPartyActivity.unload(self) self.stopDropTask() del self.activityFSM del self.__textGen for avId in self.toonSDs: if avId in self.toonSDs: toonSD = self.toonSDs[avId] toonSD.unload() del self.toonSDs self.treesAndFence.removeNode() del self.treesAndFence self.dropShadow.removeNode() del self.dropShadow base.cr.parentMgr.unregisterParent(self._avatarNodePathParentToken) for model in self.dropObjModels.values(): model.removeNode() del self.dropObjModels del self.sndGoodCatch del self.sndOof del self.sndAnvilLand del self.sndPerfect
def unload(self): DistributedPartyActivity.unload(self) self.activityFSM.request('Disabled') if self.localToonDanceSequence is not None: self.localToonDanceSequence.finish() if self.localToonDancing: self.__localStopDancing() self.ignoreAll() if self.discoBallSequence is not None: self.discoBallSequence.finish() if self.danceFloorSequence is not None: self.danceFloorSequence.finish() del self.danceFloorSequence del self.discoBallSequence del self.localToonDanceSequence if self.danceFloor is not None: self.danceFloor.removeNode() self.danceFloor = None self.__destroyOrthoWalk() for toonId in self.dancingToonFSMs.keys(): self.dancingToonFSMs[toonId].destroy() del self.dancingToonFSMs[toonId] del self.dancingToonFSMs del self.cameraParallel del self.currentCameraMode if self.keyCodes is not None: self.keyCodes.destroy() del self.keyCodes del self.activityFSM del self.gui del self.localPatternsMatched return
def __init__(self, cr, activityId, startDelay=PartyGlobals.TeamActivityStartDelay, balanceTeams=False): DistributedPartyActivity.__init__( self, cr, activityId, PartyGlobals.ActivityTypes.GuestInitiated, wantRewardGui=True) self.notify.debug('__init__') self.toonIds = ([], []) self.isLocalToonPlaying = False self.localToonTeam = None self.advantage = 1.0 self.waitToStartTimestamp = None self._maxPlayersPerTeam = 0 self._minPlayersPerTeam = 0 self._duration = 0 self._startDelay = base.config.GetFloat( 'party-team-activity-start-delay', startDelay) self._willBalanceTeams = balanceTeams self._currentStatus = '' return
def joinRequestDenied(self, reason): DistributedPartyActivity.joinRequestDenied(self, reason) self.notify.debug('joinRequestDenied') if reason == PartyGlobals.DenialReasons.Full: self.showMessage(TTLocalizer.PartyTeamActivityTeamFull) elif reason == PartyGlobals.DenialReasons.Default: self.showMessage(TTLocalizer.PartyTeamActivityJoinDenied % self.getTitle())
def _enableCollisions(self): DistributedPartyActivity._enableCollisions(self) self._enteredTree = False self.accept("enter" + self.catchTreeZoneEvent, self._toonMayHaveEnteredTree) self.accept("again" + self.catchTreeZoneEvent, self._toonMayHaveEnteredTree) self.accept("exit" + self.catchTreeZoneEvent, self._toonExitedTree) self.accept(DistributedPartyCannonActivity.LOCAL_TOON_LANDED_EVENT, self._handleCannonLanded)
def load(self): self.notify.debug('load') DistributedPartyActivity.load(self) base.cr.playGame.hood.loader.loadClouds() base.cr.playGame.hood.loader.setCloudSwitch(1) self.shadow = loader.loadModel('phase_3/models/props/drop_shadow') self.shadowNode = hidden.attachNewNode('dropShadow') self.shadow.copyTo(self.shadowNode) self.shadowNode.setColor(0, 0, 0, 0.5) self.shadowNode.setBin('fixed', 0, 1) self.splash = Splash.Splash(render) self.dustCloud = DustCloud.DustCloud(render) self.dustCloud.setBillboardPointEye() self.sndHitGround = base.loadSfx( 'phase_4/audio/sfx/MG_cannon_hit_dirt.ogg') self.sndHitWater = base.loadSfx( 'phase_4/audio/sfx/MG_cannon_splash.ogg') self.sndHitHouse = base.loadSfx( 'phase_5/audio/sfx/AA_drop_sandbag.ogg') self.sndBounce1 = base.loadSfx('phase_13/audio/sfx/bounce1.ogg') self.sndBounce2 = base.loadSfx('phase_13/audio/sfx/bounce2.ogg') self.sndBounce3 = base.loadSfx('phase_13/audio/sfx/bounce3.ogg') self.onstage() self.sign.reparentTo(hidden) self.sign.setPos(-6.0, 10.0, 0.0) self.accept(FireworksStartedEvent, self.__handleFireworksStarted) self.accept(FireworksFinishedEvent, self.__handleFireworksFinished)
def setState(self, newState, timestamp, data): DistributedPartyActivity.setState(self, newState, timestamp) if newState == 'WaitToStart': self.activityFSM.request(newState, timestamp) elif newState == 'Conclusion': self.activityFSM.request(newState, data) else: self.activityFSM.request(newState)
def exitRequestDenied(self, reason): DistributedPartyActivity.exitRequestDenied(self, reason) if reason == PartyGlobals.DenialReasons.Default: self.showMessage(TTLocalizer.PartyTeamActivityExitDenied % self.getTitle()) if self.isLocalToonPlaying and (self.isState('WaitToStart') or self.isState('WaitForEnough')): self.teamActivityGui.enableExitButton() if self._canSwitchTeams: self.teamActivityGui.enableSwitchButton()
def setToonsPlaying(self, toonIds): self.notify.info('setToonsPlaying(%s)' % (toonIds, )) DistributedPartyActivity.setToonsPlaying(self, toonIds) if self.isLocalToonInActivity( ) and base.localAvatar.doId not in toonIds: if base.localAvatar.doId in self.toonSDs: self.takeLocalAvatarOutOfActivity() self.toonSDs[base.localAvatar.doId].fsm.request('notPlaying')
def postHopOn(self): self.toon.setH(self.toon.getH() + 90.0) self.toon.dropShadow.reparentTo(self.surface) self.timeLeftToSimulate = 0.0 self.doSimulateStep = False taskMgr.add(self.updateTask, self.uniqueName('TrampolineActivity.updateTask')) base.setCellsAvailable(base.leftCells, False) base.setCellsAvailable(base.bottomCells, False) DistributedPartyActivity.startRules(self)
def unload(self): DistributedPartyActivity.unload(self) self.gui.unload() if self.music is not None: self.music.stop() self.jukebox.stop() self.jukebox.delete() self.jukebox = None self.ignoreAll()
def __init__(self, cr): DistributedPartyActivity.__init__( self, cr, PartyGlobals.ActivityIds.PartyCatch, PartyGlobals.ActivityTypes.HostInitiated, wantRewardGui=True) self.setUsesSmoothing() self.setUsesLookAround() self._sNumGen = SerialNumGen()
def _enableCollisions(self): DistributedPartyActivity._enableCollisions(self) self._enteredTree = False self.accept('enter' + self.catchTreeZoneEvent, self._toonMayHaveEnteredTree) self.accept('again' + self.catchTreeZoneEvent, self._toonMayHaveEnteredTree) self.accept('exit' + self.catchTreeZoneEvent, self._toonExitedTree) self.accept(DistributedPartyCannonActivity.LOCAL_TOON_LANDED_EVENT, self._handleCannonLanded)
def __init__(self, cr, actId, phaseToMusicData): DistributedPartyActivity.__init__(self, cr, actId, ActivityTypes.Continuous) self.phaseToMusicData = phaseToMusicData self.jukebox = None self.gui = None self.tunes = [] self.music = None self.currentSongData = None self.localQueuedSongInfo = None self.localQueuedSongListItem = None
def __init__(self, cr, doJellyBeans = True, doTricks = False, texture = None): DistributedPartyTrampolineActivity.notify.debug('__init__') DistributedPartyActivity.__init__(self, cr, PartyGlobals.ActivityIds.PartyTrampoline, PartyGlobals.ActivityTypes.GuestInitiated, wantLever=False, wantRewardGui=True) self.doJellyBeans = doJellyBeans self.doTricks = doTricks self.texture = texture self.toon = None self.trampHeight = 3.6 self.trampK = 400.0 self.normalTrampB = 2.5 self.leavingTrampB = 8.0 self.trampB = self.normalTrampB self.g = -32.0 self.jumpBoost = 330.0 self.beginningBoost = 500.0 self.beginningBoostThreshold = self.trampHeight + 1.5 self.earlyJumpThreshold = 75.0 self.boingThreshold = 300.0 self.turnFactor = 120.0 self.stepDT = 0.001 self.targetCameraPos = Point3(0.0, 40.0, 10.0) self.cameraSpeed = 2.0 self.hopOffPos = Point3(16.0, 0.0, 0.0) self.indicatorFactor = 0.0095 self.dropShadowCutoff = 15.0 self.minHeightForText = 15.0 self.heightTextOffset = -0.065 self.beanOffset = 0.5 self.guiBeanOffset = -0.02 self.jumpTextShown = False self.toonJumped = False self.turnLeft = False self.turnRight = False self.leavingTrampoline = False self.toonVelocity = 0.0 self.topHeight = 0.0 self.lastPeak = 0.0 self.beginRoundInterval = None self.hopOnAnim = None self.hopOffAnim = None self.flashTextInterval = None self.numJellyBeans = PartyGlobals.TrampolineNumJellyBeans self.jellyBeanBonus = PartyGlobals.TrampolineJellyBeanBonus self.jellyBeanStartHeight = 20.0 self.jellyBeanStopHeight = 90.0 self.jellyBeanColors = [VBase4(1.0, 0.5, 0.5, 1.0), VBase4(0.5, 1.0, 0.5, 1.0), VBase4(0.5, 1.0, 1.0, 1.0), VBase4(1.0, 1.0, 0.4, 1.0), VBase4(0.4, 0.4, 1.0, 1.0), VBase4(1.0, 0.5, 1.0, 1.0)] delta = (self.jellyBeanStopHeight - self.jellyBeanStartHeight) / (self.numJellyBeans - 1) self.jellyBeanPositions = [ self.jellyBeanStartHeight + n * delta for n in xrange(self.numJellyBeans) ] self.doSimulateStep = False return
def unload(self): DistributedPartyActivity.unload(self) del self.activityFSM self.teamActivityGui.unload() del self.teamActivityGui if hasattr(self, 'toonIds'): del self.toonIds del self.isLocalToonPlaying del self.localToonTeam del self.advantage del self.waitToStartTimestamp
def load(self): DistributedPartyTrampolineActivity.notify.debug('load') DistributedPartyActivity.load(self) self.loadModels() self.loadCollision() self.loadGUI() self.loadSounds() self.loadIntervals() self.activityFSM = TrampolineActivityFSM(self) self.activityFSM.request('Idle') self.animFSM = TrampolineAnimFSM(self) self.setBestHeightInfo('', 0)
def generate(self): DistributedPartyActivity.generate(self) self.notify.info("localAvatar doId: %s" % base.localAvatar.doId) self.notify.info("generate()") self._generateFrame = globalClock.getFrameCount() self._id2gen = {} self._orderedGenerations = [] self._orderedGenerationIndex = None rng = RandomNumGen(self.doId) self._generationSeedBase = rng.randrange(1000) self._lastDropTime = 0.0 return
def load(self): DistributedPartyActivity.load(self) self.danceFloor = loader.loadModel(self.model) self.danceFloor.reparentTo(self.getParentNodePath()) self.danceFloor.setPos(self.x, self.y, 0.0) self.danceFloor.setH(self.h) self.danceFloor.wrtReparentTo(render) self.sign.setPos(22, -22, 0) floor = self.danceFloor.find('**/danceFloor_mesh') self.danceFloorSequence = Sequence(Wait(0.3), Func(floor.setH, floor, 36)) discoBall = self.danceFloor.find('**/discoBall_mesh') self.discoBallSequence = Parallel(discoBall.hprInterval(6.0, Vec3(360, 0, 0)), Sequence(discoBall.posInterval(3, Point3(0, 0, 1), blendType='easeInOut'), discoBall.posInterval(3, Point3(0, 0, 0), blendType='easeInOut')))
def generate(self): DistributedPartyActivity.generate(self) self.notify.info('localAvatar doId: %s' % base.localAvatar.doId) self.notify.info('generate()') self._generateFrame = globalClock.getFrameCount() self._id2gen = {} self._orderedGenerations = [] self._orderedGenerationIndex = None rng = RandomNumGen(self.doId) self._generationSeedBase = rng.randrange(1000) self._lastDropTime = 0.0 return
def load(self): DistributedPartyActivity.load(self) self.jukebox = Actor('phase_13/models/parties/jukebox_model', {'dance': 'phase_13/models/parties/jukebox_dance'}) self.jukebox.reparentTo(self.root) self.jukebox.loop('dance', fromFrame=0, toFrame=48) self.collNode = CollisionNode(self.getCollisionName()) self.collNode.setCollideMask(ToontownGlobals.CameraBitmask | ToontownGlobals.WallBitmask) collTube = CollisionTube(0, 0, 0, 0.0, 0.0, 4.25, 2.25) collTube.setTangible(1) self.collNode.addSolid(collTube) self.collNodePath = self.jukebox.attachNewNode(self.collNode) self.sign.reparentTo(self.jukebox) self.sign.setPos(-5.0, 0, 0) self.activate()
def __init__(self, cr, actId, dancePatternToAnims, model = 'phase_13/models/parties/danceFloor'): DistributedPartyActivity.__init__(self, cr, actId, ActivityTypes.Continuous) self.model = model self.danceFloor = None self.localToonDancing = False self.keyCodes = None self.gui = None self.currentCameraMode = None self.orthoWalk = None self.cameraParallel = None self.localToonDanceSequence = None self.localPatternsMatched = [] self.dancePatternToAnims = dancePatternToAnims self.dancingToonFSMs = {} return
def __init__(self, cr, activityId, startDelay = PartyGlobals.TeamActivityStartDelay, balanceTeams = False): DistributedPartyActivity.__init__(self, cr, activityId, PartyGlobals.ActivityTypes.GuestInitiated, wantRewardGui=True) self.notify.debug('__init__') self.toonIds = ([], []) self.isLocalToonPlaying = False self.localToonTeam = None self.advantage = 1.0 self.waitToStartTimestamp = None self._maxPlayersPerTeam = 0 self._minPlayersPerTeam = 0 self._duration = 0 self._startDelay = base.config.GetFloat('party-team-activity-start-delay', startDelay) self._willBalanceTeams = balanceTeams self._currentStatus = '' return
def setState(self, newState, timestamp): self.notify.info("setState(%s, %s)" % (newState, timestamp)) DistributedPartyCatchActivity.notify.debug("setState( newState=%s, ... )" % newState) DistributedPartyActivity.setState(self, newState, timestamp) self.activityFSM.request(newState) if newState == "Active": if base.localAvatar.doId != self.party.partyInfo.hostId: if globalClock.getFrameCount() > self._generateFrame: if ( base.localAvatar.getX() > self.x - self.StageHalfWidth and base.localAvatar.getX() < self.x + self.StageHalfWidth and base.localAvatar.getY() > self.y - self.StageHalfHeight and base.localAvatar.getY() < self.y + self.StageHalfHeight ): self._toonEnteredTree(None) return
def getTitle(self): if self.doJellyBeans: return TTLocalizer.PartyTrampolineJellyBeanTitle elif self.doTricks: return TTLocalizer.PartyTrampolineTricksTitle else: return DistributedPartyActivity.getTitle(self)
def setState(self, newState, timestamp): self.notify.info('setState(%s, %s)' % (newState, timestamp)) DistributedPartyCatchActivity.notify.debug( 'setState( newState=%s, ... )' % newState) DistributedPartyActivity.setState(self, newState, timestamp) self.activityFSM.request(newState) if newState == 'Active': if base.localAvatar.doId != self.party.partyInfo.hostId: if globalClock.getFrameCount() > self._generateFrame: if base.localAvatar.getX( ) > self.x - self.StageHalfWidth and base.localAvatar.getX( ) < self.x + self.StageHalfWidth and base.localAvatar.getY( ) > self.y - self.StageHalfHeight and base.localAvatar.getY( ) < self.y + self.StageHalfHeight: self._toonEnteredTree(None) return
def __init__(self, cr): DistributedPartyActivity.__init__(self, cr, ActivityIds.PartyCannon, ActivityTypes.Continuous, wantRewardGui=True) self.gui = None self.firingCannon = None self.shadowNode = None self.partyDoId = None self.splash = None self.dustCloud = None self.lastWakeTime = 0 self.localFlyingDropShadow = None self.localFlyingToon = None self.localFlyingToonId = 0 self._lastBroadcastTime = -self.BroadcastPeriod self._dirtyNewVel = None self.hitBumper = 0 self.hitCloud = 0 self.lastPos = Vec3(0, 0, 0) self.lastVel = Vec3(0, 0, 0) self.vel = Vec3(0, 0, 0) self.landingPos = Vec3(0, 0, 0) self.t = 0 self.lastT = 0 self.deltaT = 0 self._lastCloudHit = None self.cameraPos = Vec3(0, -15.0, -25.0) self.cameraSpeed = 5.0 self.camNode = None self.flyingToonOffsetRotation = 0 self.flyingToonOffsetAngle = 0 self.flyingToonOffsetX = 0 self.flyingToonOffsetY = 0 self.flyingToonCloudsHit = 0 self.initialFlyVel = 0 self._localPlayedBefore = False self.hitTrack = None self.cTrav = None self.flyColNode = None self.flyColNodePath = None self._flyingCollisionTaskName = None
def disable(self): taskMgr.remove(self._remoteToonFlyTaskName) if self._flyingCollisionTaskName: taskMgr.remove(self._flyingCollisionTaskName) taskMgr.remove(self.taskNameFireCannon) taskMgr.remove(self.taskNameShoot) taskMgr.remove(self.taskNameFly) taskMgr.remove(DistributedPartyCannonActivity.REACTIVATE_CLOUD_TASK) self.ignoreAll() if self.localFlyingToonId: self.__stopCollisionHandler(self.localFlyingToon) self.__stopLocalFlyTask(self.localFlyingToonId) self.setMovie(PartyGlobals.CANNON_MOVIE_CLEAR, self.localFlyingToonId) if self.hitTrack is not None: self.hitTrack.finish() del self.hitTrack self.hitTrack = None DistributedPartyActivity.disable(self) return
def load(self): self.notify.debug('load') DistributedPartyActivity.load(self) base.cr.playGame.hood.loader.loadClouds() base.cr.playGame.hood.loader.setCloudSwitch(1) self.shadow = loader.loadModel('phase_3/models/props/drop_shadow') self.shadowNode = hidden.attachNewNode('dropShadow') self.shadow.copyTo(self.shadowNode) self.shadowNode.setColor(0, 0, 0, 0.5) self.shadowNode.setBin('fixed', 0, 1) self.splash = Splash.Splash(render) self.dustCloud = DustCloud.DustCloud(render) self.dustCloud.setBillboardPointEye() self.sndHitGround = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg') self.sndHitWater = base.loadSfx('phase_4/audio/sfx/MG_cannon_splash.ogg') self.sndHitHouse = base.loadSfx('phase_5/audio/sfx/AA_drop_sandbag.ogg') self.sndBounce1 = base.loadSfx('phase_13/audio/sfx/bounce1.ogg') self.sndBounce2 = base.loadSfx('phase_13/audio/sfx/bounce2.ogg') self.sndBounce3 = base.loadSfx('phase_13/audio/sfx/bounce3.ogg') self.onstage() self.sign.reparentTo(hidden) self.sign.setPos(-6.0, 10.0, 0.0) self.accept(FireworksStartedEvent, self.__handleFireworksStarted) self.accept(FireworksFinishedEvent, self.__handleFireworksFinished)
def load(self): DistributedPartyActivity.load(self) self.teamActivityGui = TeamActivityGui(self) self.activityFSM = TeamActivityFSM(self)
def setState(self, newState, timestamp): DistributedPartyTrampolineActivity.notify.debug( 'setState( newState=%s, ... )' % newState) DistributedPartyActivity.setState(self, newState, timestamp) self.activityFSM.request(newState)
def __init__(self, cr, doJellyBeans=True, doTricks=False, texture=None): DistributedPartyTrampolineActivity.notify.debug('__init__') DistributedPartyActivity.__init__( self, cr, PartyGlobals.ActivityIds.PartyTrampoline, PartyGlobals.ActivityTypes.GuestInitiated, wantLever=False, wantRewardGui=True) self.doJellyBeans = doJellyBeans self.doTricks = doTricks self.texture = texture self.toon = None self.trampHeight = 3.6 self.trampK = 400.0 self.normalTrampB = 2.5 self.leavingTrampB = 8.0 self.trampB = self.normalTrampB self.g = -32.0 self.jumpBoost = 330.0 self.beginningBoost = 500.0 self.beginningBoostThreshold = self.trampHeight + 1.5 self.earlyJumpThreshold = 75.0 self.boingThreshold = 300.0 self.turnFactor = 120.0 self.stepDT = 0.001 self.targetCameraPos = Point3(0.0, 40.0, 10.0) self.cameraSpeed = 2.0 self.hopOffPos = Point3(16.0, 0.0, 0.0) self.indicatorFactor = 0.0095 self.dropShadowCutoff = 15.0 self.minHeightForText = 15.0 self.heightTextOffset = -0.065 self.beanOffset = 0.5 self.guiBeanOffset = -0.02 self.jumpTextShown = False self.toonJumped = False self.turnLeft = False self.turnRight = False self.leavingTrampoline = False self.toonVelocity = 0.0 self.topHeight = 0.0 self.lastPeak = 0.0 self.beginRoundInterval = None self.hopOnAnim = None self.hopOffAnim = None self.flashTextInterval = None self.numJellyBeans = PartyGlobals.TrampolineNumJellyBeans self.jellyBeanBonus = PartyGlobals.TrampolineJellyBeanBonus self.jellyBeanStartHeight = 20.0 self.jellyBeanStopHeight = 90.0 self.jellyBeanColors = [ VBase4(1.0, 0.5, 0.5, 1.0), VBase4(0.5, 1.0, 0.5, 1.0), VBase4(0.5, 1.0, 1.0, 1.0), VBase4(1.0, 1.0, 0.4, 1.0), VBase4(0.4, 0.4, 1.0, 1.0), VBase4(1.0, 0.5, 1.0, 1.0) ] delta = (self.jellyBeanStopHeight - self.jellyBeanStartHeight) / (self.numJellyBeans - 1) self.jellyBeanPositions = [ self.jellyBeanStartHeight + n * delta for n in xrange(self.numJellyBeans) ] self.doSimulateStep = False return
def exitRequestDenied(self, reason): DistributedPartyActivity.exitRequestDenied(self, reason) self.showMessage(TTLocalizer.PartyActivityDefaultExitDeny)
def handleRewardDone(self): DistributedPartyActivity.handleRewardDone(self) if self._doneCannons: self.__localToonDoneLanding()
def startRules(self): self.notify.debug('startRules') if self.isLocalToonPlaying: DistributedPartyActivity.startRules(self)
def finishRules(self): self.notify.debug('finishRules') if self.isLocalToonPlaying: DistributedPartyActivity.finishRules(self) if self.activityFSM.getCurrentOrNextState() == 'WaitForEnough': DistributedPartyActivity.finishRules(self)
def generateInit(self): DistributedPartyActivity.generateInit(self) self.taskNameFireCannon = self.taskName('fireCannon') self.taskNameShoot = self.taskName('shootTask') self.taskNameFly = self.taskName('flyTask') self.gui = CannonGui()