本文整理汇总了Python中direct.gui.DirectGui.DirectWaitBar.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python DirectWaitBar.destroy方法的具体用法?Python DirectWaitBar.destroy怎么用?Python DirectWaitBar.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectWaitBar
的用法示例。
在下文中一共展示了DirectWaitBar.destroy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Fighter
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
#.........这里部分代码省略.........
# Termina la partida
if (self.ship.terminarPartida):
self.terminarPartida()
return tarea.done
return tarea.cont
# Termina partida liberando recursos para poder empezar una nueva
# sin reiniciar el juego
def terminarPartida(self):
# Solicita al usuario un nombre para la tabla de puntuaciones
self.entrada = DirectEntry(width = 15, numLines = 1, scale = 0.07,
cursorKeys = 1, frameSize = (0, 15, 0, 1), command = self.almacenarPuntuacion,
pos = (-0.3, 0, 0.1), focus = True, text_pos = (0.2, 0.2))
self.puntos = self.ship.puntos
self.ship.ship.detachNode()
self.ship.ship.remove()
taskMgr.remove("Mover Nave")
taskMgr.remove("Generar Enemigos")
taskMgr.remove("Comprobar Impactos")
taskMgr.remove("Actualizar Puntuacion")
taskMgr.remove("Explosionar*")
self.mostrarFinPartida()
# Libera los recursos de la partida que ha terminado
self.ship.eliminarObjetos()
del self.ship
del self.menuGraphics
del self.menu
self.marcadorNP.detachNode()
self.marcadorNP.remove()
self.barraEnergia.destroy()
del self.marcador
del self.barraEnergia
#self.inicializarMenu()
# Almacena la puntuacion del jugador
def almacenarPuntuacion(self, valor):
self.crearBDD()
db = sqlite3.connect("datos.db")
cursor = db.cursor()
parametros = (valor, self.puntos)
cursor.execute("insert into puntuaciones values (?, ?)", parametros)
db.commit()
cursor.close()
self.entrada.destroy()
self.mostrarTopPuntuacion()
self.inicializarMenu()
# Crea la Base de Datos si no existe ya
def crearBDD(self):
db = sqlite3.connect("datos.db")
cursor = db.cursor()
args = ("puntuaciones",)
cursor.execute("select name from sqlite_master where name = ?", args)
if len(cursor.fetchall()) == 0:
cursor.execute("create table puntuaciones (nombre text, puntuacion numeric)")
db.commit()
示例2: DistributedMazeGame
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
#.........这里部分代码省略.........
42,
40,
38,
35,
32]}}
self.CELL_WIDTH = MazeData.CELL_WIDTH
self.MAX_FRAME_MOVE = self.CELL_WIDTH / 2
startOffset = 3
self.startPosHTable = [[Point3(0, startOffset, self.TOON_Z), 0],
[Point3(0, -startOffset, self.TOON_Z), 180],
[Point3(startOffset, 0, self.TOON_Z), 270],
[Point3(-startOffset, 0, self.TOON_Z), 90]]
self.camOffset = Vec3(0, -19, 45)
def load(self):
self.notify.debug('load')
DistributedMinigame.load(self)
self.__defineConstants()
mazeName = MazeGameGlobals.getMazeName(self.doId, self.numPlayers, MazeData.mazeNames)
self.maze = Maze.Maze(mazeName)
model = loader.loadModel('phase_3.5/models/props/mickeySZ')
self.treasureModel = model.find('**/mickeySZ')
model.removeNode()
self.treasureModel.setScale(1.6)
self.treasureModel.setP(-90)
self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.ogg')
self.toonHitTracks = {}
self.scorePanels = []
def unload(self):
self.notify.debug('unload')
DistributedMinigame.unload(self)
del self.toonHitTracks
self.maze.destroy()
del self.maze
self.treasureModel.removeNode()
del self.treasureModel
del self.music
self.removeChildGameFSM(self.gameFSM)
del self.gameFSM
def onstage(self):
self.notify.debug('onstage')
DistributedMinigame.onstage(self)
self.maze.onstage()
self.randomNumGen.shuffle(self.startPosHTable)
lt = base.localAvatar
lt.reparentTo(render)
lt.hideName()
self.__placeToon(self.localAvId)
lt.setAnimState('Happy', 1.0)
lt.setSpeed(0, 0)
self.camParent = render.attachNewNode('mazeGameCamParent')
self.camParent.reparentTo(base.localAvatar)
self.camParent.setPos(0, 0, 0)
self.camParent.setHpr(render, 0, 0, 0)
camera.reparentTo(self.camParent)
camera.setPos(self.camOffset)
self.__spawnCameraTask()
self.toonRNGs = []
for i in xrange(self.numPlayers):
self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))
self.treasures = []
for i in xrange(self.maze.numTreasures):
self.treasures.append(MazeTreasure.MazeTreasure(self.treasureModel, self.maze.treasurePosList[i], i, self.doId))
示例3: DistributedCogBattle
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
#.........这里部分代码省略.........
return self.cogsRemaining
def setHoodIndex(self, index):
self.hoodIndex = index
def getHoodIndex(self):
return self.hoodIndex
def startPlacePoll(self):
taskMgr.add(self.__placePoll, 'DistributedCogBattle-placePoll')
def __placePoll(self, task):
if self.cr.playGame.getPlace() != None:
self.sendUpdate('arrived', [])
self.constructArea()
self.createInterface()
self.__doIntroMessages()
return task.done
else:
return task.cont
return
def stopPlacePoll(self):
taskMgr.remove('DistributedCogBattle-placePoll')
def createInterface(self):
self.cogProgressBar = DirectWaitBar(pos=(0, 0, -0.9), relief=DGG.RAISED, scale=0.6, frameColor=(1, 0.5, 0.3, 0.75), barColor=(1, 0.25, 0.25, 0.5), value=0, range=self.getTotalCogs(), text='', text_scale=0.08)
self.__updateProgressBar()
def __updateProgressBar(self):
self.cogProgressBar.update(self.getCogsRemaining())
self.cogProgressBar['text'] = '{0}/{1} {2} Remaining'.format(self.getCogsRemaining(), self.getTotalCogs(), CIGlobals.Suits)
def destroyInterface(self):
if self.cogProgressBar:
self.cogProgressBar.destroy()
self.cogProgressBar = None
return
def createBossGui(self):
self.destroyInterface()
backgroundGui = loader.loadModel('phase_5/models/cogdominium/tt_m_gui_csa_flyThru.bam')
backgroundGui.find('**/chatBubble').removeNode()
bg = backgroundGui.find('**/background')
bg.setScale(5.2)
bg.setPos(0.14, 0, -0.6667)
bg.reparentTo(aspect2d)
self.frame = DirectFrame(geom=bg, relief=None, pos=(0.2, 0, -0.6667))
return
def constructArea(self):
for data in self.DNCData[self.hoodIndex]:
dnc = loader.loadModel('phase_3.5/models/props/do_not_cross.egg')
dnc.setPos(*data[0])
dnc.setHpr(*data[1])
dnc.setScale(data[2])
dnc.reparentTo(render)
self.DNCSigns.append(dnc)
def deconstructArea(self):
for dnc in self.DNCSigns:
dnc.removeNode()
def createWhisper(self, msg):
whisper = Whisper()
whisper.createSystemMessage(msg)
示例4: __init__
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
class CIProgressScreen:
def __init__(self):
self.bgm = loader.loadModel('phase_3/models/gui/progress-background.bam')
self.bgm.find('**/logo').stash()
self.bg = self.bgm.find('**/bg')
self.logo = loader.loadTexture('phase_3/maps/CogInvasion_Logo.png')
self.logoImg = OnscreenImage(image=self.logo, scale=(0.5, 0, 0.3), pos=(0, 0, 0), parent=hidden)
self.logoImg.setTransparency(True)
self.bg_img = OnscreenImage(image=self.bg, parent=hidden)
self.bg_img.setSx(1.35)
self.bg_img.hide()
self.progress_bar = DirectWaitBar(value=0, pos=(0, 0, -0.85), parent=hidden, text_pos=(0, 0, 0.2))
self.progress_bar.setSx(1.064)
self.progress_bar.setSz(0.38)
self.loading_lbl = DirectLabel(text='', relief=None, scale=0.08, pos=(-1.0725, 0, -0.79), text_align=TextNode.ALeft, sortOrder=100, text_fg=(0.343, 0.343, 0.343, 1.0), text_font=CIGlobals.getMinnieFont(), parent=hidden, text_shadow=(0, 0, 0, 1))
return
def begin(self, hood, range, wantGui):
render.hide()
self.renderFrames()
base.setBackgroundColor(0, 0, 0)
if hood == 'localAvatarEnterGame':
self.loading_lbl['text'] = 'Entering...'
elif hood == 'init':
self.loading_lbl['text'] = 'Loading...'
else:
self.loading_lbl['text'] = 'Heading to %s...' % hood
self.progress_bar['barColor'] = (0.343, 0.343, 0.343, 1.0)
self.progress_bar['range'] = range
self.bgm.reparentTo(aspect2d)
self.bg.reparentTo(render2d)
self.bg_img.reparentTo(hidden)
self.loading_lbl.reparentTo(aspect2d)
self.logoImg.reparentTo(aspect2d)
self.progress_bar.reparentTo(aspect2d)
self.__count = 0
self.__expectedCount = range
self.progress_bar.update(self.__count)
def renderFramesTask(self, task):
self.renderFrames()
return task.cont
def end(self):
base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
taskMgr.remove('renderFrames')
render.show()
self.progress_bar.finish()
self.bg_img.reparentTo(hidden)
self.logoImg.reparentTo(hidden)
self.bg.reparentTo(hidden)
self.bgm.reparentTo(hidden)
self.loading_lbl.reparentTo(hidden)
self.progress_bar.reparentTo(hidden)
self.renderFrames()
def destroy(self):
self.bg.removeNode()
del self.bg
self.bgm.removeNode()
del self.bgm
self.bg_img.destroy()
self.loading_lbl.destroy()
self.progress_bar.destroy()
self.bgm.destroy()
del self.bg_img
del self.loading_lbl
del self.progress_bar
del self.bgm
def renderFrames(self):
base.graphicsEngine.renderFrame()
base.graphicsEngine.renderFrame()
def tick(self):
self.__count += 1
self.progress_bar.update(self.__count)
示例5: __init__
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
#.........这里部分代码省略.........
self.iceCube.removeNode()
del self.iceCube
def enterFreezeUp(self):
length = 1.0
base.playSfx(self.freezeUpSfx)
self.fucsIval = Sequence(LerpColorScaleInterval(base.localAvatar.getGeomNode(), duration=length, colorScale=VBase4(0.5, 0.5, 1.0, 1.0), startColorScale=base.localAvatar.getGeomNode().getColorScale(), blendType='easeOut'), Func(self.fsm.request, 'frozen'))
self.fucsIval.start()
self.playground.startWaterWatch(0)
def exitFreezeUp(self):
self.fucsIval.pause()
del self.fucsIval
self.playground.stopWaterWatch()
def enterFrozen(self):
self.loadIceCube()
base.cr.playGame.getPlace().fsm.request('stop', [0])
base.localAvatar.stop()
base.playSfx(choice(self.frozenSfxArray))
self.iccsIval = LerpColorScaleInterval(self.iceCube, duration=0.5, colorScale=VBase4(0.76, 0.76, 1.0, 1.0), startColorScale=self.iceCube.getColorScale(), blendType='easeInOut')
self.iccsIval.start()
props = WindowProperties()
props.setCursorHidden(True)
base.win.requestProperties(props)
self.frame = DirectFrame(pos=(0, 0, 0.7))
self.powerBar = DirectWaitBar(frameColor=(1, 1, 1, 1), range=100, value=0, scale=(0.4, 0.5, 0.25), parent=self.frame, barColor=(0.55, 0.7, 1.0, 1.0))
self.label = OnscreenText(text='SHAKE MOUSE', shadow=(0, 0, 0, 1), fg=(0.55, 0.7, 1.0, 1.0), pos=(0, -0.1, 0), parent=self.frame)
taskMgr.add(self.__watchMouseMovement, 'BRWater-watchMouseMovement')
taskMgr.add(self.__lowerPowerBar, 'BRWater-lowerPowerBar')
mw = base.mouseWatcherNode
if mw.hasMouse():
self.lastMouseX = mw.getMouseX()
def __lowerPowerBar(self, task):
if self.powerBar['value'] <= 0:
self.powerBar.update(0)
decrement = 1
self.powerBar.update(self.powerBar['value'] - decrement)
task.delayTime = 0.1
return task.again
def __watchMouseMovement(self, task):
if self.powerBar['value'] >= self.powerBar['range']:
self.fsm.request('coolDown', [1])
return task.done
mw = base.mouseWatcherNode
if mw.hasMouse():
if not self.lastMouseX or self.lastMouseX != mw.getMouseX():
value = 3 * self.lastMouseX - mw.getMouseX()
self.lastMouseX = mw.getMouseX()
self.powerBar.update(self.powerBar['value'] + abs(value))
return task.cont
def exitFrozen(self):
props = WindowProperties()
props.setCursorHidden(False)
base.win.requestProperties(props)
self.iccsIval.pause()
del self.iccsIval
self.unloadIceCube()
taskMgr.remove('BRWater-lowerPowerBar')
taskMgr.remove('BRWater-watchMouseMovement')
self.label.destroy()
del self.label
self.powerBar.destroy()
del self.powerBar
self.frame.destroy()
del self.frame
del self.lastMouseX
base.cr.playGame.getPlace().fsm.request('walk')
base.localAvatar.b_setAnimState('neutral')
def enterCoolDown(self, fromFrozen = 0):
if fromFrozen:
self.loadIceCube()
self.iceCube.setColorScale(0.76, 0.76, 1.0, 1.0)
self.iccdIval = LerpColorScaleInterval(self.iceCube, duration=0.5, colorScale=VBase4(0.76, 0.76, 1.0, 0.0), startColorScale=self.iceCube.getColorScale(), blendType='easeInOut')
self.iccdIval.start()
length = 1.0
base.playSfx(choice(self.coolSfxArray))
self.cdcsIval = Sequence(LerpColorScaleInterval(base.localAvatar.getGeomNode(), duration=length, colorScale=VBase4(1.0, 1.0, 1.0, 1.0), startColorScale=base.localAvatar.getGeomNode().getColorScale(), blendType='easeOut'), Func(self.fsm.request, 'off'))
self.cdcsIval.start()
def exitCoolDown(self):
if hasattr(self, 'iccdIval'):
self.iccdIval.pause()
del self.iccdIval
self.unloadIceCube()
self.cdcsIval.pause()
del self.cdcsIval
def cleanup(self):
self.fsm.requestFinalState()
self.playground.stopWaterWatch()
del self.fsm
del self.freezeUpSfx
del self.frozenSfxArray
del self.coolSfxArray
del self.playground
示例6: DistributedPieTurretManager
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
class DistributedPieTurretManager(DistributedObject):
notify = directNotify.newCategory("DistributedPieTurretManager")
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.myTurret = None
self.guiFrame = None
self.guiLabel = None
self.guiBar = None
self.guiBg = None
self.turretGag = None
return
def announceGenerate(self):
DistributedObject.announceGenerate(self)
base.taskMgr.add(self.__pollMyBattle, "__pollMyBattle")
def disable(self):
base.taskMgr.remove("DPTM.pollTurret")
base.taskMgr.remove("__pollMyBattle")
if hasattr(self, "makeTurretBtn"):
self.makeTurretBtn.destroy()
del self.makeTurretBtn
self.destroyGui()
self.myTurret = None
if base.localAvatar.getMyBattle():
base.localAvatar.getMyBattle().setTurretManager(None)
DistributedObject.disable(self)
return
def __pollTurret(self, turretId, task):
turret = self.cr.doId2do.get(turretId)
if turret != None:
self.myTurret = turret
self.turretGag = None
self.makeGui()
return Task.done
else:
return Task.cont
def setGag(self, upgradeId):
self.turretGag = upgradeId
def d_requestPlace(self, posHpr):
self.sendUpdate("requestPlace", [posHpr])
def turretPlaced(self, turretId):
turret = self.cr.doId2do.get(turretId)
turret.b_setGag(self.turretGag)
self.turretGag = None
base.taskMgr.add(self.__pollTurret, "DPTM.pollTurret", extraArgs=[turretId], appendTask=True)
return
def yourTurretIsDead(self):
base.taskMgr.remove("DPTM.pollTurret")
self.destroyGui()
self.myTurret = None
if base.localAvatar.getPUInventory()[0] > 0:
self.createTurretButton()
return
def makeGui(self):
self.destroyGui()
self.guiFrame = DirectFrame(parent=base.a2dBottomRight, pos=(-0.55, 0, 0.15))
self.guiBg = OnscreenImage(image="phase_4/maps/turret_gui_bg.png", scale=(0.15, 0, 0.075), parent=self.guiFrame)
self.guiBg.setTransparency(True)
self.guiLabel = DirectLabel(
text="Turret",
text_fg=(1, 0, 0, 1),
relief=None,
text_scale=0.05,
text_font=loader.loadFont("phase_3/models/fonts/ImpressBT.ttf"),
pos=(0, 0, 0.025),
parent=self.guiFrame,
)
self.guiBar = DirectWaitBar(
range=self.myTurret.getMaxHealth(),
value=self.myTurret.getHealth(),
scale=0.125,
parent=self.guiFrame,
pos=(0, 0, -0.01),
)
return
def createTurretButton(self):
self.makeTurretBtn = DirectButton(
relief=None,
geom=CIGlobals.getDefaultBtnGeom(),
text="Turret",
text_scale=0.055,
command=self.handleMakeTurretBtn,
pos=(-0.47, 0, 0.1),
geom_scale=(0.5, 1.0, 1.0),
text_pos=(0, -0.01),
parent=base.a2dBottomRight,
)
return
def handleMakeTurretBtn(self):
self.makeTurretBtn.destroy()
#.........这里部分代码省略.........
示例7: BossBattleHealthBar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
#.........这里部分代码省略.........
elif hp > 0.15:
condition = 7
elif hp > 0.05:
condition = 8
elif hp > 0.0:
condition = 9
else:
condition = 9
return condition
def updateHealthBar(self, hp):
self.hp = float(hp)
self.healthCondition = self.getHealthCondition(hp)
if self.healthCondition == 9 and hp > 0:
if self.blinkTask is None:
self.startBlinkTask()
elif self.blinkTask:
self.stopBlinkTask()
if self.healthBar:
self.healthBar.setProp('text', str(int(hp)))
self.healthBar.setProp('barColor', self.healthColors[self.healthCondition])
self.healthBar.setProp('value', hp / self.maxHp)
self.doHit()
def cleanupHit(self):
if self.hitInterval:
self.hitInterval.finish()
self.hitInterval = None
return
def doHit(self):
self.cleanupHit()
if not self.headActor:
return
self.hitInterval = Sequence(
Parallel(
Sequence(
Func(self.headActor.setColorScale, 1, 1, 1, 1),
self.headActor.colorScaleInterval(0.1, colorScale=VBase4(1, 0, 0, 1)),
self.headActor.colorScaleInterval(0.3, colorScale=VBase4(1, 1, 1, 1))
),
ActorInterval(self.headActor, 'turn2Fb')
),
Func(self.headActor.loop, 'Ff_neutral')
)
self.hitInterval.start()
def startBlinkTask(self):
self.blinkTask = Task.loop(Task(self.__blinkRed), Task.pause(0.75), Task(self.__blinkGray), Task.pause(0.1))
taskMgr.add(self.blinkTask, 'bosshealthbar-blink-task')
def __blinkRed(self, task):
if not self.healthBar:
return
self.healthBar.setProp('barColor', self.healthColors[8])
return Task.done
def __blinkGray(self, task):
if not self.healthBar:
return
self.healthBar.setProp('barColor', self.healthColors[9])
return Task.done
def stopBlinkTask(self):
taskMgr.remove('bosshealthbar-blink-task')
self.blinkTask = None
def setDizzy(self, dizzy):
self.dizzy = dizzy
if dizzy:
self.stars.reparentTo(self.headActor)
else:
self.stars.detachNode()
def setHelmet(self, helmet):
self.helmet = helmet
if helmet:
self.safe.show()
self.eyes.show()
else:
self.safe.hide()
self.eyes.hide()
def destroy(self):
self.cleanupHit()
self.stars.cleanup()
self.stopBlinkTask()
self.healthBar.destroy()
self.headActor.delete()
self.head.removeNode()
self.safe.removeNode()
self.eyes.removeNode()
示例8: CameraShyFirstPerson
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import destroy [as 别名]
#.........这里部分代码省略.........
return
def __handleRayInto(self, entry):
intoNP = entry.getIntoNodePath()
toonNP = intoNP.getParent()
for key in base.cr.doId2do.keys():
obj = base.cr.doId2do[key]
if obj.__class__.__name__ == 'DistributedToon':
if obj.getKey() == toonNP.getKey():
self.__handleToonInFocus(obj)
def __handleRayOut(self, entry):
intoNP = entry.getIntoNodePath()
toonNP = intoNP.getParent()
for key in base.cr.doId2do.keys():
obj = base.cr.doId2do[key]
if obj.__class__.__name__ == 'DistributedToon':
if obj.getKey() == toonNP.getKey():
self.toonToTakePicOf = None
self.hasToonInFocus = False
if self.cameraFocus.getColorScale() == self.toonInFocusColor:
self.cameraFocus.setColorScale(self.toonOutOfFocusColor)
return
def __handleToonInFocus(self, toon):
if not self.hasToonInFocus or self.toonToTakePicOf is not None or self.toonToTakePicOf.doId != toon.doId:
self.toonToTakePicOf = toon
self.hasToonInFocus = True
self.cameraFocus.setColorScale(self.toonInFocusColor)
return
def start(self):
self.fullyChargedSound = base.loadSfx('phase_4/audio/sfx/MG_pairing_match.mp3')
self.rechargeSound = base.loadSfx('phase_4/audio/sfx/MG_sfx_travel_game_blue_arrow.mp3')
self.batteryFrame = DirectFrame(parent=base.a2dBottomRight, pos=(-0.2, 0, 0.1), scale=(0.8, 0, 1))
self.batteryBg = OnscreenImage(image='phase_4/maps/battery_charge_frame.png', parent=self.batteryFrame)
self.batteryBg.setTransparency(1)
self.batteryBg.setX(0.03)
self.batteryBg.setScale(0.17, 0, 0.05)
self.batteryBar = DirectWaitBar(value=0, range=5, barColor=(1, 1, 1, 1), relief=None, scale=(0.12, 0.0, 0.3), parent=self.batteryFrame)
self.cameraFocus = loader.loadModel('phase_4/models/minigames/photo_game_viewfinder.bam')
self.cameraFocus.reparentTo(base.aspect2d)
self.focusCollHandler = CollisionHandlerEvent()
self.focusCollHandler.setInPattern('%fn-into')
self.focusCollHandler.setOutPattern('%fn-out')
self.focusCollNode = CollisionNode('mouseRay')
self.focusCollNP = base.camera.attachNewNode(self.focusCollNode)
self.focusCollNode.setCollideMask(BitMask32(0))
self.focusCollNode.setFromCollideMask(CIGlobals.WallBitmask)
self.focusRay = CollisionRay()
self.focusRay.setFromLens(base.camNode, 0.0, 0.0)
self.focusCollNode.addSolid(self.focusRay)
base.cTrav.addCollider(self.focusCollNP, self.focusCollHandler)
base.localAvatar.walkControls.setWalkSpeed(CIGlobals.ToonForwardSpeed, 0.0, CIGlobals.ToonReverseSpeed, CIGlobals.ToonRotateSpeed)
FirstPerson.start(self)
return
def reallyStart(self):
self.accept('mouseRay-into', self.__handleRayInto)
self.accept('mouseRay-out', self.__handleRayOut)
self.camFSM.request('recharge')
taskMgr.add(self.movementTask, 'movementTask')
FirstPerson.reallyStart(self)
def end(self):
self.camFSM.request('off')
taskMgr.remove('movementTask')
self.ignore('mouseRay-into')
self.ignore('mouseRay-out')
FirstPerson.end(self)
def reallyEnd(self):
self.batteryBar.destroy()
self.batteryBar = None
self.batteryBg.destroy()
self.batteryBg = None
self.batteryFrame.destroy()
self.batteryFrame = None
self.cameraFocus.removeNode()
self.cameraFocus = None
self.focusCollHandler = None
self.focusCollNode = None
self.focusCollNP.removeNode()
self.focusCollNP = None
self.focusRay = None
self.hasToonInFocus = None
self.toonToTakePicOf = None
self.fullyChargedSound = None
self.rechargeSound = None
self.stopCameraFlash()
FirstPerson.reallyEnd(self)
base.localAvatar.walkControls.setWalkSpeed(CIGlobals.ToonForwardSpeed, CIGlobals.ToonJumpForce, CIGlobals.ToonReverseSpeed, CIGlobals.ToonRotateSpeed)
return
def cleanup(self):
self.camFSM.requestFinalState()
self.camFSM = None
FirstPerson.cleanup(self)
return