コード例 #1
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def startTrap(self):
     TrapGag.startTrap(self)
     if not self.gag:
         self.build()
         self.setHandJoint()
     self.gag.reparentTo(self.handJoint)
     self.avatar.play('toss', fromFrame=22)
コード例 #2
0
 def startTrap(self):
     TrapGag.startTrap(self)
     if not self.gag:
         self.build()
         self.setHandJoint()
     self.gag.reparentTo(self.handJoint)
     self.avatar.play('toss', fromFrame=22)
コード例 #3
0
    def release(self):
        throwPath = NodePath('ThrowPath')
        throwPath.reparentTo(self.avatar)
        throwPath.setScale(render, 1)
        throwPath.setPos(0, 160, -120)
        throwPath.setHpr(0, 90, 0)

        if not self.gag:
            self.build()

        self.entity = self.gag
        self.gag = None
        self.entity.wrtReparentTo(render)
        self.entity.setHpr(throwPath.getHpr(render))

        self.setHandJoint()
        self.track = ProjectileInterval(self.entity,
                                        startPos=self.handJoint.getPos(render),
                                        endPos=throwPath.getPos(render),
                                        gravityMult=0.9,
                                        duration=3)
        self.track.start()

        if self.isLocal():
            self.startTimeout()
            self.buildCollisions()
            self.avatar.acceptOnce('gagSensor-into', self.onCollision)

        self.reset()
        TrapGag.release(self)
コード例 #4
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, damage, hitSfx, idleSfx = None, particlesFx = None, anim = None, wantParticles = True):
     TrapGag.__init__(self, name, model, damage, hitSfx, anim)
     self.wantParticles = wantParticles
     self.particles = None
     self.particlesFx = particlesFx
     self.idleSfx = None
     if game.process == 'client':
         if idleSfx:
             self.idleSfx = base.audio3d.loadSfx(idleSfx)
     return
コード例 #5
0
ファイル: ActivateTrapGag.py プロジェクト: coginvasion/src
 def start(self):
     TrapGag.startTrap(self)
     if self.trapMode == 0:
         LocationGag.start(self, self.avatar)
     elif self.trapMode == 1:
         if not self.gag:
             self.build()
             self.setHandJoint()
         self.gag.reparentTo(self.handJoint)
         self.avatar.play('toss', fromFrame=22)
コード例 #6
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def onCollision(self, entry):
     TrapGag.onCollision(self, entry)
     gag = self.gag
     if not gag:
         gag = self.entity
     x, y, z = gag.getPos(render)
     self.avatar.sendUpdate('setGagPos', [self.getID(),
      x,
      y,
      z])
コード例 #7
0
 def start(self):
     TrapGag.startTrap(self)
     if self.trapMode == 0:
         LocationGag.start(self, self.avatar)
     else:
         if self.trapMode == 1:
             if not self.gag:
                 self.build()
                 self.setHandJoint()
             self.gag.reparentTo(self.handJoint)
             self.avatar.play('toss', fromFrame=22)
コード例 #8
0
    def start(self):
        TrapGag.startTrap(self)

        # Let's start the location seeker if we're using a trapdoor or quicksand gag.
        if self.trapMode == 0:
            LocationGag.start(self, self.avatar)
        elif self.trapMode == 1:
            if not self.gag:
                self.build()
                self.setHandJoint()
            self.gag.reparentTo(self.handJoint)
            self.avatar.play('toss', fromFrame=22)
コード例 #9
0
ファイル: ActivateTrapGag.py プロジェクト: coginvasion/src
 def __init__(self, name, model, damage, hitSfx, collRadius, mode = 0, anim = None, autoRelease = True, activateSfx = None):
     TrapGag.__init__(self, name, model, damage, hitSfx, anim, doesAutoRelease=autoRelease)
     LocationGag.__init__(self, 10, 50, shadowScale=0.25)
     self.trapMode = mode
     self.entities = []
     self.lifeTime = 120
     self.minSafeDistance = 5
     self.collRadius = collRadius
     self.activateSfx = None
     if game.process == 'client':
         if activateSfx:
             self.activateSfx = base.audio3d.loadSfx(activateSfx)
     return
コード例 #10
0
 def __init__(self, name, model, damage, hitSfx, collRadius, mode=0, anim=None, autoRelease=True, activateSfx=None):
     TrapGag.__init__(self, name, model, damage, hitSfx, anim, doesAutoRelease=autoRelease)
     LocationGag.__init__(self, 10, 50, shadowScale=0.25)
     self.trapMode = mode
     self.entities = []
     self.lifeTime = 120
     self.minSafeDistance = 5
     self.collRadius = collRadius
     self.activateSfx = None
     self.entityTrack = None
     if game.process == 'client':
         if activateSfx:
             self.activateSfx = base.audio3d.loadSfx(activateSfx)
     return
コード例 #11
0
ファイル: ActivateTrapGag.py プロジェクト: coginvasion/src
 def release(self):
     TrapGag.release(self)
     if self.trapMode == 0:
         LocationGag.release(self)
         self.build()
         self.buildCollisions()
         actorTrack = LocationGag.getActorTrack(self)
         if actorTrack:
             LocationGag.getSoundTrack(self).start()
             if self.isLocal():
                 actorTrack.append(Func(self.avatar.b_gagThrow, self.getID()))
             actorTrack.start()
     elif self.trapMode == 1:
         self.startEntity()
コード例 #12
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def buildCollisions(self):
     TrapGag.buildCollisions(self)
     gagSph = CollisionSphere(0, 0, 0, 1)
     gagSph.setTangible(0)
     gagNode = CollisionNode('gagSensor')
     gagNode.addSolid(gagSph)
     gagNP = self.gag.attachNewNode(gagNode)
     gagNP.setScale(0.75, 0.8, 0.75)
     gagNP.setPos(0.0, 0.1, 0.5)
     gagNP.setCollideMask(BitMask32.bit(0))
     gagNP.node().setFromCollideMask(CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.setInPattern('%fn-into')
     event.setOutPattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
コード例 #13
0
 def release(self):
     TrapGag.release(self)
     if self.trapMode == 0:
         LocationGag.release(self)
         self.build()
         self.buildCollisions()
         actorTrack = LocationGag.getActorTrack(self)
         if actorTrack:
             LocationGag.getSoundTrack(self).start()
             if self.isLocal():
                 actorTrack.append(Func(self.avatar.b_gagThrow, self.getID()))
             actorTrack.start()
     else:
         if self.trapMode == 1:
             self.startEntity()
コード例 #14
0
 def buildCollisions(self):
     TrapGag.buildCollisions(self)
     gagSph = CollisionSphere(0, 0, 0, 1)
     gagSph.setTangible(0)
     gagNode = CollisionNode('gagSensor')
     gagNode.addSolid(gagSph)
     gagNP = self.entity.attachNewNode(gagNode)
     gagNP.setScale(0.75, 0.8, 0.75)
     gagNP.setPos(0.0, 0.1, 0.5)
     gagNP.setCollideMask(BitMask32.bit(0))
     gagNP.node().setFromCollideMask(CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.setInPattern('%fn-into')
     event.setOutPattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
     self.avatar.acceptOnce('gagSensor-into', self.onCollision)
コード例 #15
0
    def release(self):
        TrapGag.release(self)

        # Let's release the location seeker if we're using a trapdoor or quicksand.
        if self.trapMode == 0:
            LocationGag.release(self)
            self.build()
            self.buildCollisions()
            actorTrack = LocationGag.getActorTrack(self)
            if actorTrack:
                LocationGag.getSoundTrack(self).start()
                if self.isLocal():
                    actorTrack.append(
                        Func(self.avatar.b_gagThrow, self.getID()))
                actorTrack.start()
        elif self.trapMode == 1:
            self.startEntity()
コード例 #16
0
 def buildCollisions(self):
     TrapGag.buildCollisions(self)
     gagSph = CollisionSphere(0, 0, 0, self.collRadius)
     gagSph.setTangible(0)
     gagNode = CollisionNode('gagSensor')
     gagNode.addSolid(gagSph)
     gagNP = self.gag.attachNewNode(gagNode)
     gagNP.setScale(0.75, 0.8, 0.75)
     gagNP.setPos(0.0, 0.1, 0.5)
     gagNP.setCollideMask(BitMask32.bit(0))
     gagNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
     if self.isLocal():
         self.avatar.accept('gagSensor-into', self.onCollision)
コード例 #17
0
ファイル: ActivateTrapGag.py プロジェクト: coginvasion/src
 def buildCollisions(self):
     TrapGag.buildCollisions(self)
     gagSph = CollisionSphere(0, 0, 0, self.collRadius)
     gagSph.setTangible(0)
     gagNode = CollisionNode('gagSensor')
     gagNode.addSolid(gagSph)
     gagNP = self.gag.attachNewNode(gagNode)
     gagNP.setScale(0.75, 0.8, 0.75)
     gagNP.setPos(0.0, 0.1, 0.5)
     gagNP.setCollideMask(BitMask32.bit(0))
     gagNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask)
     event = CollisionHandlerEvent()
     event.set_in_pattern('%fn-into')
     event.set_out_pattern('%fn-out')
     base.cTrav.addCollider(gagNP, event)
     if self.isLocal():
         self.avatar.accept('gagSensor-into', self.onCollision)
コード例 #18
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def release(self):
     TrapGag.release(self)
     throwPath = NodePath('ThrowPath')
     throwPath.reparentTo(self.avatar)
     throwPath.setScale(render, 1)
     throwPath.setPos(0, 160, -120)
     throwPath.setHpr(0, 90, 0)
     if not self.gag:
         self.build()
     self.gag.wrtReparentTo(render)
     self.gag.setHpr(throwPath.getHpr(render))
     self.setHandJoint()
     self.track = ProjectileInterval(self.gag, startPos=self.handJoint.getPos(render), endPos=throwPath.getPos(render), gravityMult=0.9, duration=3)
     self.track.start()
     if base.localAvatar == self.avatar:
         self.buildCollisions()
         self.avatar.acceptOnce('gagSensor-into', self.onCollision)
     self.reset()
コード例 #19
0
    def __init__(self,
                 name,
                 model,
                 damage,
                 hitSfx,
                 idleSfx=None,
                 particlesFx=None,
                 anim=None,
                 wantParticles=True):
        TrapGag.__init__(self, name, model, damage, hitSfx, anim)
        self.wantParticles = wantParticles
        self.particles = None
        self.particlesFx = particlesFx
        self.idleSfx = None
        self.timeout = 5.0

        if game.process == 'client':
            if idleSfx:
                self.idleSfx = base.audio3d.loadSfx(idleSfx)
コード例 #20
0
    def __init__(self,
                 name,
                 model,
                 damage,
                 hitSfx,
                 collRadius,
                 mode=0,
                 anim=None,
                 autoRelease=True,
                 activateSfx=None):
        TrapGag.__init__(self,
                         name,
                         model,
                         damage,
                         hitSfx,
                         anim,
                         doesAutoRelease=autoRelease)
        LocationGag.__init__(self, 10, 50, shadowScale=0.25)

        # This is the mode the trap gag is on. 0) Trapdoor/Quicksand and 1) Banana Peel, marbles, etc.
        self.trapMode = mode

        # This keeps track of the entities we drop.
        self.entities = []

        # This is the length (in seconds) of how long an entity exists.
        self.lifeTime = 120

        # This is the minimum distance an entity has to be from another.
        self.minSafeDistance = 5

        # This is the radius of the CollisionSphere that detects suits.
        self.collRadius = collRadius

        # This is the sound effect called when a trap is tripped.
        self.activateSfx = None

        self.entityTrack = None

        if game.process == 'client':
            if activateSfx:
                self.activateSfx = base.audio3d.loadSfx(activateSfx)
コード例 #21
0
ファイル: ActivateTrapGag.py プロジェクト: coginvasion/src
 def equip(self):
     TrapGag.equip(self)
コード例 #22
0
 def onCollision(self, entry):
     TrapGag.onCollision(self, entry)
     x, y, z = self.entity.getPos(render)
     base.localAvatar.sendUpdate('setGagPos', [self.getID(), x, y, z])
コード例 #23
0
 def build(self):
     TrapGag.build(self)
     self.buildParticles()
     self.setHandJoint()
コード例 #24
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def unEquip(self):
     TrapGag.unEquip(self)
     self.cleanupParticles()
コード例 #25
0
 def unEquip(self):
     TrapGag.unEquip(self)
     self.cleanupParticles()
コード例 #26
0
 def delete(self):
     TrapGag.delete(self)
     self.cleanupParticles()
コード例 #27
0
ファイル: ActivateTrapGag.py プロジェクト: coginvasion/src
 def unEquip(self):
     TrapGag.unEquip(self)
     LocationGag.cleanupLocationSeeker(self)
コード例 #28
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def build(self):
     TrapGag.build(self)
     self.buildParticles()
     self.setHandJoint()
コード例 #29
0
 def unEquip(self):
     TrapGag.unEquip(self)
     LocationGag.cleanupLocationSeeker(self)
コード例 #30
0
 def equip(self):
     TrapGag.equip(self)
コード例 #31
0
ファイル: TossTrapGag.py プロジェクト: coginvasion/src
 def delete(self):
     TrapGag.delete(self)
     self.cleanupParticles()