def cleanup(self): if hasattr(self, 'maxCogs') and not self.cleanedUp: self.cleanedUp = True LocationSeeker.cleanup(self) if self.chargingSfx and self.tickSfx: base.audio3d.detachSound(self.chargingSfx) base.audio3d.detachSound(self.tickSfx) self.chargingSfx.stop() self.tickSfx.stop() if self.shadowTrack: self.shadowTrack.pause() self.shadowTrack = None if self.isCharging: self.stopCharging() del self.mouseDownName del self.pollMouseTaskName del self.chargedUpName del self.chargedCancelName del self.lMouseDn del self.chargingSfx del self.chargingSfxPath del self.tickSfx del self.tickSfxPath del self.selectionRadius del self.selectedCogs del self.maxCogs del self.gag
def startSeeking(self): LocationSeeker.startSeeking(self) if not self.dropShadow: return self.avatar.ignore('mouse1') self.lMouseDn = inputState.watch(self.mouseDownName, 'mouse1', 'mouse1-up') base.taskMgr.add(self.__pollMouseHeldDown, self.pollMouseTaskName)
def __init__(self, gag, avatar, selectionRadius, minDistance, maxDistance, shadowScale, maxCogs=4): LocationSeeker.__init__(self, avatar, minDistance, maxDistance, shadowScale) self.gag = gag self.pollMouseTaskName = 'Poll Mouse Hold Downs' self.chargedUpName = 'Charged Up' self.chargedCancelName = 'Charge Canceled' self.mouseDownName = 'mouse1-down' self.chargingSfxPath = 'phase_4/audio/sfx/MG_sfx_ice_scoring_1.ogg' self.chargingSfx = None self.tickSfxPath = 'phase_13/audio/sfx/tick_counter_short.ogg' self.tickSfx = None self.lMouseDn = None self.isCharging = False self.shadowTrack = None self.chargeDuration = 2.5 self.selectionRadius = selectionRadius self.maxCogs = maxCogs self.selectedCogs = [] self.cleanedUp = False if game.process == 'client': self.chargingSfx = base.audio3d.loadSfx(self.chargingSfxPath) self.tickSfx = base.audio3d.loadSfx(self.tickSfxPath)
def cleanup(self): if hasattr(self, 'maxCogs') and not self.cleanedUp: self.cleanedUp = True LocationSeeker.cleanup(self) if self.chargingSfx and self.tickSfx: base.audio3d.detachSound(self.chargingSfx) base.audio3d.detachSound(self.tickSfx) self.chargingSfx.stop() self.tickSfx.stop() if self.shadowTrack: self.shadowTrack.pause() self.shadowTrack = None if self.isCharging: self.stopCharging() del self.mouseDownName del self.pollMouseTaskName del self.chargedUpName del self.chargedCancelName del self.lMouseDn del self.chargingSfx del self.chargingSfxPath del self.tickSfx del self.tickSfxPath del self.selectionRadius del self.selectedCogs del self.maxCogs return
def startCharging(self): LocationSeeker.stopSeeking(self) self.dropShadow.setZ(self.dropShadow.getZ() - 0.45) finalScale = 6 self.shadowTrack = Sequence() chargeTrack = Parallel(LerpScaleInterval(self.dropShadow, self.chargeDuration, finalScale, startScale=self.dropShadow.getScale(), blendType='easeInOut'), Func(base.audio3d.attachSoundToObject, self.chargingSfx, self.dropShadow), SoundInterval(self.chargingSfx, duration=self.chargeDuration, node=self.dropShadow)) self.shadowTrack.append(chargeTrack) self.shadowTrack.append(self.__tickNearbyCogs()) self.shadowTrack.append(Func(self.onFullCharge)) self.shadowTrack.start() self.isCharging = True
def startCharging(self): LocationSeeker.stopSeeking(self) self.dropShadow.setZ(self.dropShadow.getZ() - 0.45) finalScale = 6 self.shadowTrack = Sequence() chargeTrack = Parallel(LerpScaleInterval(self.dropShadow, self.chargeDuration, finalScale, startScale=self.dropShadow.getScale(), blendType='easeInOut'), Func(base.audio3d.attachSoundToObject, self.chargingSfx, self.dropShadow), SoundInterval(self.chargingSfx, duration=self.chargeDuration)) self.shadowTrack.append(chargeTrack) self.shadowTrack.append(self.__tickNearbyCogs()) self.shadowTrack.append(Func(self.onFullCharge)) self.shadowTrack.start() self.isCharging = True
def startSeeking(self): LocationSeeker.startSeeking(self) if not self.dropShadow: return # Let's actually ignore LEFT mouse clicks. self.avatar.ignore('mouse1') # Instead, let's start listening to LEFT mouse hold downs. self.lMouseDn = inputState.watch(self.mouseDownName, 'mouse1', 'mouse1-up') base.taskMgr.add(self.__pollMouseHeldDown, self.pollMouseTaskName)
def __init__(self, avatar, selectionRadius, minDistance, maxDistance, shadowScale, maxCogs = 4): LocationSeeker.__init__(self, avatar, minDistance, maxDistance, shadowScale) self.pollMouseTaskName = 'Poll Mouse Hold Downs' self.chargedUpName = 'Charged Up' self.chargedCancelName = 'Charge Canceled' self.mouseDownName = 'mouse1-down' self.chargingSfxPath = 'phase_4/audio/sfx/MG_sfx_ice_scoring_1.mp3' self.chargingSfx = None self.tickSfxPath = 'phase_13/audio/sfx/tick_counter_short.mp3' self.tickSfx = None self.lMouseDn = None self.isCharging = False self.shadowTrack = None self.chargeDuration = 2.5 self.selectionRadius = selectionRadius self.maxCogs = maxCogs self.selectedCogs = [] self.cleanedUp = False if game.process == 'client': self.chargingSfx = base.audio3d.loadSfx(self.chargingSfxPath) self.tickSfx = base.audio3d.loadSfx(self.tickSfxPath) return