コード例 #1
0
 def release(self):
     Gag.release(self)
     base.audio3d.attachSoundToObject(self.woosh, self.gag)
     base.playSfx(self.woosh, node=self.gag)
     throwPath = NodePath('ThrowPath')
     throwPath.reparentTo(self.avatar)
     throwPath.setScale(render, 1)
     throwPath.setPos(0, self.power, -90)
     throwPath.setHpr(90, -90, 90)
     entity = self.gag
     if not entity:
         entity = self.build()
     entity.wrtReparentTo(render)
     entity.setHpr(throwPath.getHpr(render))
     self.gag = None
     if not self.handJoint:
         self.handJoint = self.avatar.find('**/def_joint_right_hold')
     track = ProjectileInterval(entity, startPos=self.handJoint.getPos(render), endPos=throwPath.getPos(render), gravityMult=0.9, duration=3)
     event = self.avatar.uniqueName('throwIvalDone') + '-' + str(hash(entity))
     track.setDoneEvent(event)
     base.acceptOnce(event, self.__handlePieIvalDone, [entity])
     track.start()
     self.entities.append([entity, track])
     if self.isLocal():
         self.buildCollisions(entity)
         base.localAvatar.sendUpdate('usedGag', [self.id])
     self.reset()
     return
コード例 #2
0
ファイル: TrapGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, damage, hitSfx, anim = None, doesAutoRelease = True):
     Gag.__init__(self, name, model, damage, GagType.TRAP, hitSfx, anim=anim, autoRelease=doesAutoRelease)
     self.hitSfx = None
     self.entity = None
     if game.process == 'client':
         self.hitSfx = base.audio3d.loadSfx(hitSfx)
     return
コード例 #3
0
 def __init__(self,
              name,
              model,
              damage,
              hitSfx,
              splatColor,
              anim=None,
              scale=1):
     Gag.__init__(self,
                  name,
                  model,
                  damage,
                  GagType.THROW,
                  hitSfx,
                  anim=anim,
                  scale=scale)
     self.splatScale = GagGlobals.splatSizes[self.name]
     self.splatColor = splatColor
     self.entities = []
     self.timeout = 1.0
     self.power = 50
     self.powerBar = None
     self.tossPieStart = 0
     self.pieSpeed = 0.2
     self.pieExponent = 0.75
コード例 #4
0
 def build(self):
     if not self.gag:
         Gag.build(self)
         self.equip()
         if self.anim and self.gag:
             self.gag.loop('chan')
     return self.gag
コード例 #5
0
 def delete(self):
     taskMgr.remove("powerBarUpdate" + str(hash(self)))
     taskMgr.remove("hidePowerBarTask" + str(hash(self)))
     if self.powerBar:
         self.powerBar.destroy()
         self.powerBar = None
     Gag.delete(self)
コード例 #6
0
 def __init__(self,
              name,
              model,
              minHeal,
              maxHeal,
              efficiency,
              healSfx,
              playRate,
              anim=None):
     Gag.__init__(self,
                  name,
                  model,
                  0,
                  GagType.TOON_UP,
                  healSfx,
                  anim=anim,
                  playRate=playRate,
                  scale=1,
                  autoRelease=False)
     self.minHeal = minHeal
     self.maxHeal = maxHeal
     self.efficiency = efficiency
     self.lHandJoint = None
     self.hips = None
     self.PNTNEARZERO = Point3(0.01, 0.01, 0.01)
     self.PNTNORMAL = Point3(1, 1, 1)
     self.healAmount = None
コード例 #7
0
ファイル: ThrowGag.py プロジェクト: coginvasion/src
 def build(self):
     if not self.gag:
         Gag.build(self)
         self.equip()
         if self.anim and self.gag:
             self.gag.loop('chan')
     return self.gag
コード例 #8
0
ファイル: SquirtGag.py プロジェクト: coginvasion/src
 def start(self):
     Gag.start(self)
     if self.anim:
         self.build()
         self.equip()
         duration = base.localAvatar.getDuration(self.anim, toFrame=self.enableReleaseFrame)
         Parallel(ActorInterval(self.avatar, self.anim, startFrame=self.startAnimFrame, endFrame=self.enableReleaseFrame, playRate=self.playRate), Wait(duration - 0.15), Func(self.setSquirtEnabled, True)).start()
コード例 #9
0
 def __init__(self, name, model, damage, hitSfx, anim = None, doesAutoRelease = True):
     Gag.__init__(self, name, model, damage, GagType.TRAP, hitSfx, anim = anim, autoRelease = doesAutoRelease)
     self.hitSfx = None
     self.entity = None
     self.timeout = 3.0
     if game.process == 'client':
         self.hitSfx = base.audio3d.loadSfx(hitSfx)
コード例 #10
0
    def __init__(self,
                 name,
                 model,
                 damage,
                 appearSfx,
                 soundSfx,
                 soundRange=18,
                 hitSfx=None):
        Gag.__init__(self,
                     name,
                     model,
                     damage,
                     GagType.SOUND,
                     hitSfx,
                     playRate=1,
                     anim=None,
                     scale=1,
                     autoRelease=True)
        self.appearSfx = None
        self.soundSfx = None
        self.soundRange = soundRange
        self.megaphonePath = 'phase_5/models/props/megaphone.bam'
        self.megaphone = None
        self.tracks = None
        self.timeout = 5.0

        if game.process == 'client':
            self.appearSfx = base.audio3d.loadSfx(appearSfx)
            self.soundSfx = base.audio3d.loadSfx(soundSfx)
コード例 #11
0
 def delete(self):
     taskMgr.remove('powerBarUpdate' + str(hash(self)))
     taskMgr.remove('hidePowerBarTask' + str(hash(self)))
     if self.powerBar:
         self.powerBar.destroy()
         self.powerBar = None
     Gag.delete(self)
     return
コード例 #12
0
 def cleanupGag(self):
     if self.state == GagState.LOADED or self.state == GagState.RECHARGING:
         Gag.cleanupGag(self)
         if self.megaphone:
             copies = self.avatar.findAllMatches('**/%s' %
                                                 self.megaphone.getName())
             for copy in copies:
                 copy.removeNode()
         self.megaphone = None
コード例 #13
0
ファイル: SoundGag.py プロジェクト: coginvasion/src
    def cleanupGag(self):
        if self.state == GagState.LOADED:
            Gag.cleanupGag(self)
            if self.megaphone:
                copies = self.avatar.findAllMatches('**/%s' % self.megaphone.getName())
                for copy in copies:
                    copy.removeNode()

            self.megaphone = None
        return
コード例 #14
0
ファイル: SoundGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, damage, appearSfx, soundSfx, soundRange = 18, hitSfx = None):
     Gag.__init__(self, name, model, damage, GagType.SOUND, hitSfx, playRate=1, anim=None, scale=1, autoRelease=True)
     self.appearSfx = None
     self.soundSfx = None
     self.soundRange = soundRange
     self.megaphonePath = 'phase_5/models/props/megaphone.bam'
     self.megaphone = None
     if game.process == 'client':
         self.appearSfx = base.audio3d.loadSfx(appearSfx)
         self.soundSfx = base.audio3d.loadSfx(soundSfx)
     return
コード例 #15
0
ファイル: ToonUpGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, minHeal, maxHeal, efficiency, healSfx, playRate, anim = None):
     Gag.__init__(self, name, model, 0, GagType.TOON_UP, healSfx, anim=anim, playRate=playRate, scale=1, autoRelease=False)
     self.minHeal = minHeal
     self.maxHeal = maxHeal
     self.efficiency = efficiency
     self.lHandJoint = None
     self.hips = None
     self.PNTNEARZERO = Point3(0.01, 0.01, 0.01)
     self.PNTNORMAL = Point3(1, 1, 1)
     self.healAmount = None
     return
コード例 #16
0
 def start(self):
     Gag.start(self)
     if self.isLocal():
         self.startTimeout()
     if self.tracks:
         self.tracks.pause()
         self.tracks = None
     self.build()
     base.audio3d.attachSoundToObject(self.soundSfx, self.avatar)
     base.audio3d.attachSoundToObject(self.appearSfx, self.avatar)
     if self.isLocal():
         base.localAvatar.sendUpdate('usedGag', [self.id])
コード例 #17
0
 def setAvatar(self, avatar):
     Gag.setAvatar(self, avatar)
     if self.isLocal():
         self.powerBar = DirectWaitBar(range=150,
                                       frameColor=(1, 1, 1, 1),
                                       barColor=(0.286, 0.901, 1, 1),
                                       relief=DGG.RAISED,
                                       borderWidth=(0.04, 0.04),
                                       pos=(0, 0, 0.85),
                                       scale=0.2,
                                       hpr=(0, 0, 0),
                                       parent=aspect2d,
                                       frameSize=(-0.85, 0.85, -0.12, 0.12))
         self.powerBar.hide()
コード例 #18
0
ファイル: DropGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, anim, damage, hitSfx, missSfx, scale, playRate):
     Gag.__init__(self, name, model, damage, GagType.DROP, hitSfx, anim=anim, playRate=playRate, scale=scale, autoRelease=True)
     LocationGag.__init__(self, 10, 50)
     self.missSfx = None
     self.fallSoundPath = 'phase_5/audio/sfx/incoming_whistleALT.mp3'
     self.fallSoundInterval = None
     self.fallSfx = None
     self.chooseLocFrame = 34
     self.completeFrame = 77
     self.collHandlerF = CollisionHandlerFloor()
     self.fallDuration = 0.75
     self.isDropping = False
     if game.process == 'client':
         self.missSfx = base.audio3d.loadSfx(missSfx)
         self.fallSfx = base.audio3d.loadSfx(self.fallSoundPath)
     return
コード例 #19
0
    def __init__(self,
                 name,
                 model,
                 damage,
                 hitSfx,
                 spraySfx,
                 missSfx,
                 toonAnim,
                 enableReleaseFrame,
                 completeSquirtFrame,
                 startAnimFrame=0,
                 scale=1,
                 playRate=1):
        Gag.__init__(self,
                     name,
                     model,
                     damage,
                     GagType.SQUIRT,
                     hitSfx,
                     scale=scale,
                     autoRelease=True,
                     playRate=playRate)
        self.sprayScale = GagGlobals.splatSizes.get(self.name)
        self.spraySfx = None
        self.missSfx = None
        self.origin = None
        self.sprayRange = None
        self.spray = None
        self.sprayJoint = None
        self.canSquirt = False
        self.hitSomething = False
        self.toonAnim = toonAnim
        self.startAnimFrame = 0
        self.enableReleaseFrame = enableReleaseFrame
        self.completeSquirtFrame = completeSquirtFrame
        self.lastFrame = 0
        self.tracks = None
        self.sprayTrack = None
        self.sprayAttempt = None
        self.sprayRotation = Vec3(0, 0, 0)

        if game.process == 'client':
            if spraySfx:
                self.spraySfx = base.audio3d.loadSfx(spraySfx)
            if missSfx:
                self.missSfx = base.audio3d.loadSfx(missSfx)
コード例 #20
0
 def start(self):
     Gag.start(self)
     if self.sprayTrack:
         self.sprayTrack.pause()
         self.sprayTrack = None
     if self.tracks:
         self.tracks.pause()
         self.tracks = None
     if self.anim:
         self.build()
         self.equip()
         duration = base.localAvatar.getDuration(
             self.toonAnim, toFrame=self.enableReleaseFrame)
         self.sprayAttempt = Parallel(
             ActorInterval(self.avatar,
                           self.toonAnim,
                           startFrame=self.startAnimFrame,
                           endFrame=self.enableReleaseFrame,
                           playRate=self.playRate), Wait(duration - 0.15),
             Func(self.setSquirtEnabled, True)).start()
コード例 #21
0
ファイル: SquirtGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, damage, hitSfx, spraySfx, missSfx, toonAnim, enableReleaseFrame, completeSquirtFrame, startAnimFrame = 0, scale = 1, playRate = 1):
     Gag.__init__(self, name, model, damage, GagType.SQUIRT, hitSfx, scale=scale, autoRelease=True, playRate=playRate)
     self.sprayScale = GagGlobals.splatSizes.get(self.name)
     self.spraySfx = None
     self.missSfx = None
     self.origin = None
     self.sprayRange = None
     self.spray = None
     self.sprayJoint = None
     self.canSquirt = False
     self.hitSomething = False
     self.toonAnim = toonAnim
     self.startAnimFrame = 0
     self.enableReleaseFrame = enableReleaseFrame
     self.completeSquirtFrame = completeSquirtFrame
     self.lastFrame = 0
     if game.process == 'client':
         if spraySfx:
             self.spraySfx = base.audio3d.loadSfx(spraySfx)
         if missSfx:
             self.missSfx = base.audio3d.loadSfx(missSfx)
     return
コード例 #22
0
    def __init__(self, name, model, anim, damage, hitSfx, missSfx, scale,
                 playRate):
        Gag.__init__(self,
                     name,
                     model,
                     damage,
                     GagType.DROP,
                     hitSfx,
                     anim=anim,
                     playRate=playRate,
                     scale=scale,
                     autoRelease=True)
        LocationGag.__init__(self, 10, 50)
        self.missSfx = None
        self.fallSoundPath = 'phase_5/audio/sfx/incoming_whistleALT.ogg'
        self.fallSoundInterval = None
        self.fallSfx = None
        self.chooseLocFrame = 34
        self.completeFrame = 77
        self.collHandlerF = CollisionHandlerFloor()
        self.fallDuration = 0.75
        self.isDropping = False
        self.timeout = 3.0
        if game.process == 'client':
            self.missSfx = base.audio3d.loadSfx(missSfx)
            self.fallSfx = base.audio3d.loadSfx(self.fallSoundPath)

        # Variables to handle the drop preview with large drops.
        self.crashSite = None
        self.crashSiteGag = None
        self.crashSiteShadow = None
        self.crashSiteIval = None
        self.crashStartPos = None
        self.crashEndPos = None
        self.crashBegun = False
        self.shadowIdleTaskName = 'Handle-IdleShadow'
        self.shadowIdleTime = 0.0
コード例 #23
0
ファイル: ThrowGag.py プロジェクト: coginvasion/src
 def release(self):
     Gag.release(self)
     base.audio3d.attachSoundToObject(self.woosh, self.gag)
     self.woosh.play()
     throwPath = NodePath('ThrowPath')
     throwPath.reparentTo(self.avatar)
     throwPath.setScale(render, 1)
     throwPath.setPos(0, 160, -90)
     throwPath.setHpr(90, -90, 90)
     entity = self.gag
     if not entity:
         entity = self.build()
     entity.wrtReparentTo(render)
     entity.setHpr(throwPath.getHpr(render))
     self.gag = None
     if not self.handJoint:
         self.handJoint = self.avatar.find('**/def_joint_right_hold')
     track = ProjectileInterval(entity, startPos=self.handJoint.getPos(render), endPos=throwPath.getPos(render), gravityMult=0.9, duration=3)
     track.start()
     self.entities.append([entity, track])
     if self.isLocal():
         self.buildCollisions(entity)
     self.reset()
     return
コード例 #24
0
ファイル: SoundGag.py プロジェクト: coginvasion/src
 def build(self):
     Gag.build(self)
     self.megaphone = loader.loadModel(self.megaphonePath)
コード例 #25
0
 def start(self):
     Gag.start(self)
     if self.isLocal():
         self.startTimeout()
     if self.isLocal():
         base.localAvatar.sendUpdate('usedGag', [self.id])
コード例 #26
0
 def unEquip(self):
     Gag.unEquip(self)
     self.finish()
コード例 #27
0
 def unEquip(self):
     taskMgr.remove("hidePowerBarTask" + str(hash(self)))
     if self.powerBar:
         self.powerBar.hide()
     Gag.unEquip(self)
コード例 #28
0
 def build(self):
     Gag.build(self)
     self.megaphone = loader.loadModel(self.megaphonePath)
コード例 #29
0
ファイル: SoundGag.py プロジェクト: coginvasion/src
 def start(self):
     Gag.start(self)
     self.build()
     base.localAvatar.sendUpdate('gagRelease', [self.getID()])
コード例 #30
0
ファイル: SoundGag.py プロジェクト: coginvasion/src
 def unEquip(self):
     Gag.unEquip(self)
     self.finish()
コード例 #31
0
 def getGag(self):
     if not self.gag:
         return self.entity
     return Gag.getGag(self)
コード例 #32
0
ファイル: ThrowGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, damage, hitSfx, splatColor, anim = None, scale = 1):
     Gag.__init__(self, name, model, damage, GagType.THROW, hitSfx, anim=anim, scale=scale)
     self.splatScale = GagGlobals.splatSizes[self.name]
     self.splatColor = splatColor
     self.entities = []