示例#1
0
 def __init__(self, parent = hidden, target = hidden):
     """
     __init(parent, target)
     parent is the render frame in which the ripples are drawn
     target is the node path which determines the ripples' positions
     """
     # Initialize the superclass
     NodePath.__init__(self)
     # Create a container node to hold ripple sequences
     self.assign(parent.attachNewNode('wake'))
     # Record the target node path
     self.target = target
     # Get a copy of the ripples sequence
     self.ripples = globalPropPool.getProp('ripples')
     # Move the master tflip slightly above origin to avoid coincident polys
     tformNode = self.ripples.getChild(0)
     tformNode.setZ(0.01)
     self.seqNodePath = self.ripples.find('**/+SequenceNode')
     self.seqNode = self.seqNodePath.node()
     # Used to specify sort order of ripples within the fixed bin
     self.sortBase = 10
     self.rippleCount = 0
     self.doLaters = [None] * 20
     self.trackId = Wake.wakeCount
     # Increment instance counter
     Wake.wakeCount += 1
 def __init__(self, parent=hidden, fBillboard=1, wantSound=0):
     """__init()"""
     # Initialize the superclass
     NodePath.__init__(self)
     # Make yourself a copy of the dustCloud texture flip
     self.assign(globalPropPool.getProp('suit_explosion_dust'))
     if fBillboard:
         self.setBillboardAxis()
     self.reparentTo(parent)
     # Init sequence node
     self.seqNode = self.find('**/+SequenceNode').node()
     self.seqNode.setFrameRate(0)
     # if we want sounds for this effect, import them
     # we should only use this if we're sure we're in phase_4 already
     self.wantSound = wantSound
     if self.wantSound and not DustCloud.sounds:
         DustCloud.sounds[SFX.poof] = loader.loadSfx(SFXPATHS[SFX.poof])
         #DustCloud.sounds[SFX.magic] = loader.loadSfx(SFXPATHS[SFX.magic])
     # This will hold an interval to play back the tflip
     self.track = None
     self.trackId = DustCloud.dustCloudCount
     # Increment instance counter
     DustCloud.dustCloudCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
    def __init__(self, parent = hidden):
        NodePath.__init__(self)
        self.assign(globalPropPool.getProp('wake'))
        self.reparentTo(parent)
        tformNode = self.getChild(0)
        tformNode.setZ(0.1)
        self.startNodePath = self.find('**/+SequenceNode')
        self.startSeqNode = self.startNodePath.node()
        self.startSeqNode.setName('start')
        self.startSeqNode.setPlayRate(0)
        self.cycleNodePath = NodePath(SequenceNode(0, 'cycle'))
        self.cycleNodePath.reparentTo(tformNode)
        self.cycleSeqNode = self.cycleNodePath.node()
        self.endNodePath = NodePath(SequenceNode(0, 'end'))
        self.endNodePath.reparentTo(tformNode)
        self.endSeqNode = self.endNodePath.node()
        children = self.startNodePath.getChildren()
        for child in children[12:16]:
            child.reparentTo(self.cycleNodePath)

        for child in children[16:]:
            child.reparentTo(self.endNodePath)

        self.tracks = []
        self.rate = None
        self.trackId = Wake.wakeCount
        Wake.wakeCount += 1
        self.setBin('fixed', 10, 1)
        self.hide()
        return
示例#4
0
 def load(self):
     self.root = NodePath('PartyCog-%d' % self.id)
     self.root.reparentTo(self.parentNode)
     path = 'phase_13/models/parties/cogPinata_'
     self.actor = Actor(
         path + 'actor', {
             'idle': path + 'idle_anim',
             'down': path + 'down_anim',
             'up': path + 'up_anim',
             'bodyHitBack': path + 'bodyHitBack_anim',
             'bodyHitFront': path + 'bodyHitFront_anim',
             'headHitBack': path + 'headHitBack_anim',
             'headHitFront': path + 'headHitFront_anim'
         })
     self.actor.setBlend(
         frameBlend=config.GetBool('interpolate-animations', True))
     self.actor.reparentTo(self.root)
     self.temp_transform = Mat4()
     self.head_locator = self.actor.attachNewNode('temphead')
     self.bodyColl = CollisionTube(0, 0, 1, 0, 0, 5.75, 0.75)
     self.bodyColl.setTangible(1)
     self.bodyCollNode = CollisionNode('PartyCog-%d-Body-Collision' %
                                       self.id)
     self.bodyCollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.bodyCollNode.addSolid(self.bodyColl)
     self.bodyCollNodePath = self.root.attachNewNode(self.bodyCollNode)
     self.headColl = CollisionTube(0, 0, 3, 0, 0, 3.0, 1.5)
     self.headColl.setTangible(1)
     self.headCollNode = CollisionNode('PartyCog-%d-Head-Collision' %
                                       self.id)
     self.headCollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.headCollNode.addSolid(self.headColl)
     self.headCollNodePath = self.root.attachNewNode(self.headCollNode)
     self.arm1Coll = CollisionSphere(1.65, 0, 3.95, 1.0)
     self.arm1Coll.setTangible(1)
     self.arm1CollNode = CollisionNode('PartyCog-%d-Arm1-Collision' %
                                       self.id)
     self.arm1CollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.arm1CollNode.addSolid(self.arm1Coll)
     self.arm1CollNodePath = self.root.attachNewNode(self.arm1CollNode)
     self.arm2Coll = CollisionSphere(-1.65, 0, 3.45, 1.0)
     self.arm2Coll.setTangible(1)
     self.arm2CollNode = CollisionNode('PartyCog-%d-Arm2-Collision' %
                                       self.id)
     self.arm2CollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.arm2CollNode.addSolid(self.arm2Coll)
     self.arm2CollNodePath = self.root.attachNewNode(self.arm2CollNode)
     splatName = 'splat-creampie'
     self.splat = globalPropPool.getProp(splatName)
     self.splat.setBillboardPointEye()
     self.splatType = globalPropPool.getPropType(splatName)
     self.pieHitSound = globalBattleSoundCache.getSound(
         'AA_wholepie_only.ogg')
     self.upSound = globalBattleSoundCache.getSound('AV_jump_to_side.ogg')
     self.hole = loader.loadModel('phase_13/models/parties/cogPinataHole')
     self.hole.setTransparency(True)
     self.hole.setP(-90.0)
     self.hole.setScale(3)
     self.hole.setBin('ground', 3)
     self.hole.reparentTo(self.parentNode)
示例#5
0
文件: Wake.py 项目: DarthNihilus1/src
    def __init__(self, parent=hidden):
        NodePath.__init__(self)
        self.assign(globalPropPool.getProp('wake'))
        self.reparentTo(parent)
        tformNode = self.getChild(0)
        tformNode.setZ(0.1)
        self.startNodePath = self.find('**/+SequenceNode')
        self.startSeqNode = self.startNodePath.node()
        self.startSeqNode.setName('start')
        self.startSeqNode.setPlayRate(0)
        self.cycleNodePath = NodePath(SequenceNode(0, 'cycle'))
        self.cycleNodePath.reparentTo(tformNode)
        self.cycleSeqNode = self.cycleNodePath.node()
        self.endNodePath = NodePath(SequenceNode(0, 'end'))
        self.endNodePath.reparentTo(tformNode)
        self.endSeqNode = self.endNodePath.node()
        children = self.startNodePath.getChildren()
        for child in children[12:16]:
            child.reparentTo(self.cycleNodePath)

        for child in children[16:]:
            child.reparentTo(self.endNodePath)

        self.tracks = []
        self.rate = None
        self.trackId = Wake.wakeCount
        Wake.wakeCount += 1
        self.setBin('fixed', 10, 1)
        self.hide()
        return
示例#6
0
 def __init__(self, parent=hidden, wantParticles=1):
     """__init()"""
     # Initialize the superclass
     NodePath.__init__(self, parent)
     # Create a toplevel node to hold splash effects
     self.assign(parent.attachNewNode('splash'))
     # Load up a copy of the splash actor
     self.splashdown = globalPropPool.getProp('splashdown')
     self.splashdown.reparentTo(self)
     self.splashdown.setZ(-0.01)
     self.splashdown.setScale(0.4)
     # Adjust transparency of splash to use MBinary
     ta = TransparencyAttrib.make(TransparencyAttrib.MBinary)
     self.splashdown.node().setAttrib(ta, 1)
     self.splashdown.setBin('fixed', 130, 1)
     # Add in a ripple effect
     self.ripples = Ripples(self)
     self.ripples.setBin('fixed', 120, 1)
     # Add some particles
     self.wantParticles = wantParticles
     if self.wantParticles:
         self.pSystem = BattleParticles.createParticleEffect('SplashLines')
         self.pSystem.setScale(0.4)
         self.pSystem.setBin('fixed', 150, 1)
         self.particles = self.pSystem.particlesDict.get('particles-1')
     # Track for playing back splash effect
     self.track = None
     self.trackId = Splash.splashCount
     Splash.splashCount += 1
     self.setBin('fixed', 100, 1)
     # Start out hidden
     self.hide()
示例#7
0
    def __showSplat(self, position, direction, hot=False):
        if self.kaboomTrack is not None and self.kaboomTrack.isPlaying():
            self.kaboomTrack.finish()
        self.clearHitInterval()
        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()
        self.splat.reparentTo(render)
        self.splat.setPos(self.root, position)
        self.splat.setAlphaScale(1.0)
        if not direction == 1.0:
            self.splat.setColorScale(PartyGlobals.CogActivitySplatColors[0])
            if self.currentFacing > 0.0:
                facing = 'HitFront'
            else:
                facing = 'HitBack'
        else:
            self.splat.setColorScale(PartyGlobals.CogActivitySplatColors[1])
            if self.currentFacing > 0.0:
                facing = 'HitBack'
            else:
                facing = 'HitFront'
        if hot:
            targetscale = 0.75
            part = 'head'
        else:
            targetscale = 0.5
            part = 'body'

        def setSplatAlpha(amount):
            self.splat.setAlphaScale(amount)

        self.hitInterval = Sequence(
            ActorInterval(self.actor, part + facing, loop=0),
            Func(self.actor.loop, 'idle'))
        self.hitInterval.start()
        self.kaboomTrack = Parallel(
            SoundInterval(self.pieHitSound,
                          volume=1.0,
                          node=self.actor,
                          cutOff=PartyGlobals.PARTY_COG_CUTOFF),
            Sequence(
                Func(self.splat.showThrough),
                Parallel(
                    Sequence(
                        LerpScaleInterval(self.splat,
                                          duration=0.175,
                                          scale=targetscale,
                                          startScale=Point3(0.1, 0.1, 0.1),
                                          blendType='easeOut'), Wait(0.175)),
                    Sequence(
                        Wait(0.1),
                        LerpFunc(setSplatAlpha,
                                 duration=1.0,
                                 fromData=1.0,
                                 toData=0.0,
                                 blendType='easeOut'))),
                Func(self.splat.cleanup), Func(self.splat.removeNode)))
        self.kaboomTrack.start()
        return
 def load(self):
     self.root = NodePath('ToonfestCog')
     self.parentNode = NodePath('Parent')
     self.parentNode.reparentTo(render)
     self.root.reparentTo(render)
     path = 'phase_13/models/parties/cogPinata_'
     self.actor = Actor.Actor(path + 'actor', {'idle': path + 'idle_anim',
      'down': path + 'down_anim',
      'up': path + 'up_anim',
      'bodyHitBack': path + 'bodyHitBack_anim',
      'bodyHitFront': path + 'bodyHitFront_anim',
      'headHitBack': path + 'headHitBack_anim',
      'headHitFront': path + 'headHitFront_anim'})
     self.actor.reparentTo(self.root)
     self.temp_transform = Mat4()
     self.head_locator = self.actor.attachNewNode('temphead')
     self.bodyColl = CollisionTube(0, 0, 1, 0, 0, 5.75, 0.75)
     self.bodyColl.setTangible(1)
     self.bodyCollNode = CollisionNode('ToonfestCog-Body-Collision')
     self.bodyCollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.bodyCollNode.addSolid(self.bodyColl)
     self.bodyCollNodePath = self.root.attachNewNode(self.bodyCollNode)
     self.headColl = CollisionTube(0, 0, 3, 0, 0, 3.0, 1.5)
     self.headColl.setTangible(1)
     self.headCollNode = CollisionNode('ToonfestCog-Head-Collision')
     self.headCollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.headCollNode.addSolid(self.headColl)
     self.headCollNodePath = self.root.attachNewNode(self.headCollNode)
     self.arm1Coll = CollisionSphere(1.65, 0, 3.95, 1.0)
     self.arm1Coll.setTangible(1)
     self.arm1CollNode = CollisionNode('ToonfestCog-Arm1-Collision')
     self.arm1CollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.arm1CollNode.addSolid(self.arm1Coll)
     self.arm1CollNodePath = self.root.attachNewNode(self.arm1CollNode)
     self.arm2Coll = CollisionSphere(-1.65, 0, 3.45, 1.0)
     self.arm2Coll.setTangible(1)
     self.arm2CollNode = CollisionNode('ToonfestCog-Arm2-Collision')
     self.arm2CollNode.setCollideMask(ToontownGlobals.PieBitmask)
     self.arm2CollNode.addSolid(self.arm2Coll)
     self.arm2CollNodePath = self.root.attachNewNode(self.arm2CollNode)
     splatName = 'splat-creampie'
     self.splat = globalPropPool.getProp(splatName)
     self.splat.setBillboardPointEye()
     self.splatType = globalPropPool.getPropType(splatName)
     self.pieHitSound = globalBattleSoundCache.getSound('AA_wholepie_only.ogg')
     self.upSound = globalBattleSoundCache.getSound('AV_jump_to_side.ogg')
     self.hole = loader.loadModel('phase_13/models/parties/cogPinataHole')
     self.hole.setTransparency(True)
     self.hole.setP(-90.0)
     self.hole.setScale(3)
     self.hole.setBin('ground', 3)
     self.hole.reparentTo(self.parentNode)
     taskMgr.doMethodLater(60, self.toggleCog, 'toggle-cog', extraArgs=[])
示例#9
0
    def __init__(self, cogIndex, suitType, game, cogSpeed):
        self.cogIndex = cogIndex
        self.suitType = suitType
        self.game = game
        self.cogSpeed = cogSpeed
        suit = Suit.Suit()
        d = SuitDNA.SuitDNA()
        d.newSuit(suitType)
        suit.setDNA(d)
        # cache the walk anim
        suit.pose('walk', 0)
        self.suit = suit
        self.goal = CTGG.NoGoal
        self.goalId = CTGG.InvalidGoalId
        self.lastLocalTimeStampFromAI = 0
        self.lastPosFromAI = Point3(0, 0, 0)
        self.lastThinkTime = 0
        self.doneAdjust = False
        self.barrel = CTGG.NoBarrelCarried
        self.signalledAtReturnPos = False
        self.defaultPlayRate = 1.0
        self.netTimeSentToStartByHit = 0

        # steering loosely based on boid code game programming gems #1
        # "Portions Copyright (C) Steven Woodcock, 2000"
        self.velocity = Vec3(0, 0, 0)
        self.oldVelocity = Vec3(0, 0, 0)
        self.acceleration = Vec3(0, 0, 0)
        self.bodyLength = self.CollisionRadius * 2
        # Desired distance from closest neighbor when flying.
        self.cruiseDistance = 2 * self.bodyLength
        self.maxVelocity = self.cogSpeed
        # Maximum magnitude of acceleration as a fraction of maxSpeed.
        self.maxAcceleration = 5.0
        self.perceptionRange = 6
        self.notify.debug('cogSpeed=%s' % self.cogSpeed)

        self.kaboomSound = loader.loadSfx(
            "phase_4/audio/sfx/MG_cannon_fire_alt.mp3")
        self.kaboom = loader.loadModel(
            'phase_4/models/minigames/ice_game_kaboom')
        self.kaboom.setScale(2.0)
        self.kaboom.setBillboardPointEye()
        self.kaboom.hide()
        self.kaboomTrack = None

        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()
        self.splatType = globalPropPool.getPropType(splatName)

        self.pieHitSound = globalBattleSoundCache.getSound(
            'AA_wholepie_only.mp3')
示例#10
0
 def __init__(self, parent = hidden):
     NodePath.__init__(self)
     self.assign(globalPropPool.getProp('ripples'))
     self.reparentTo(parent)
     self.getChild(0).setZ(0.10000000000000001)
     self.seqNode = self.find('**/+SequenceNode').node()
     self.seqNode.setPlayRate(0)
     self.track = None
     self.trackId = Ripples.rippleCount
     Ripples.rippleCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
 def __init__(self, parent=hidden):
     NodePath.__init__(self)
     self.assign(globalPropPool.getProp('ripples'))
     self.reparentTo(parent)
     self.getChild(0).setZ(0.10000000000000001)
     self.seqNode = self.find('**/+SequenceNode').node()
     self.seqNode.setPlayRate(0)
     self.track = None
     self.trackId = Ripples.rippleCount
     Ripples.rippleCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
def leftHand(prop=None):
    target = spellbook.getTarget()
    leftHand = target.find('**/leftHand')
    if prop is None:
        for child in leftHand.getChildren():
            child.removeNode()

    else:
        for child in leftHand.getChildren():
            child.removeNode()

        requestedProp = globalPropPool.getProp(prop)
        requestedProp.reparentTo(leftHand)
示例#13
0
def leftHand(prop=None):
    """
    parents the optional <prop> to the target's left hand node.
    """
    target = spellbook.getTarget()
    leftHand = target.find('**/leftHand')
    if prop is None:
        for child in leftHand.getChildren():
            child.removeNode()
    else:
        for child in leftHand.getChildren():
            child.removeNode()
        requestedProp = globalPropPool.getProp(prop)
        requestedProp.reparentTo(leftHand)
示例#14
0
 def __init__(self, parent=hidden, target=hidden):
     NodePath.__init__(self)
     self.assign(parent.attachNewNode('wake'))
     self.target = target
     self.ripples = globalPropPool.getProp('ripples')
     tformNode = self.ripples.getChild(0)
     tformNode.setZ(0.01)
     self.seqNodePath = self.ripples.find('**/+SequenceNode')
     self.seqNode = self.seqNodePath.node()
     self.sortBase = 10
     self.rippleCount = 0
     self.doLaters = [None] * 20
     self.trackId = Wake.wakeCount
     Wake.wakeCount += 1
 def __init__(self, activity, toon, position, team):
     self.activity = activity
     self.position = position
     self.toon = toon
     self.team = team
     self.netTimeSentToStartByHit = 0
     self.kaboomTrack = None
     self.locator = None
     self.teamSpot = self.activity.getIndex(self.toon.doId, self.team)
     splatName = 'splat-creampie'
     self.splat = globalPropPool.getProp(splatName)
     self.splat.setBillboardPointEye()
     self.splatType = globalPropPool.getPropType(splatName)
     self.pieHitSound = globalBattleSoundCache.getSound('AA_wholepie_only.ogg')
def leftHand(prop=None):
    """
    parents the optional <prop> to the target's left hand node.
    """
    target = spellbook.getTarget()
    leftHand = target.find('**/leftHand')
    if prop is None:
        for child in leftHand.getChildren():
            child.removeNode()
    else:
        for child in leftHand.getChildren():
            child.removeNode()
        requestedProp = globalPropPool.getProp(prop)
        requestedProp.reparentTo(leftHand)
示例#17
0
    def __showSplat(self, position):
        """Show the splat graphic and sound."""
        if self.kaboomTrack is not None and self.kaboomTrack.isPlaying():
            self.kaboomTrack.finish()

        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()

        self.splat.reparentTo(render)
        self.splat.setPos(self.toon, position)
        self.splat.setY(
            self.toon,
            bound(self.splat.getY(),
                  self.toon.getHeight() / 2.0, position.getY()))
        self.splat.setAlphaScale(1.0)

        targetscale = 0.75

        def setSplatAlpha(amount):
            self.splat.setAlphaScale(amount)

        self.kaboomTrack = Parallel(
            SoundInterval(self.pieHitSound,
                          node=self.toon,
                          volume=1.0,
                          cutOff=PartyGlobals.PARTY_COG_CUTOFF),
            Sequence(
                Func(self.splat.showThrough),
                Parallel(
                    Sequence(
                        LerpScaleInterval(self.splat,
                                          duration=0.175,
                                          scale=targetscale,
                                          startScale=Point3(0.1, 0.1, 0.1),
                                          blendType="easeOut"),
                        Wait(0.175),
                    ),
                    Sequence(
                        Wait(0.1),
                        LerpFunc(setSplatAlpha,
                                 duration=1.0,
                                 fromData=1.0,
                                 toData=0.0,
                                 blendType="easeOut"))),
                Func(self.splat.cleanup),
                Func(self.splat.removeNode),
            ))
        self.kaboomTrack.start()
 def __init__(self, parent = hidden, target = hidden):
     NodePath.__init__(self)
     self.assign(parent.attachNewNode('wake'))
     self.target = target
     self.ripples = globalPropPool.getProp('ripples')
     tformNode = self.ripples.getChild(0)
     tformNode.setZ(0.01)
     self.seqNodePath = self.ripples.find('**/+SequenceNode')
     self.seqNode = self.seqNodePath.node()
     self.sortBase = 10
     self.rippleCount = 0
     self.doLaters = [None] * 20
     self.trackId = Wake.wakeCount
     Wake.wakeCount += 1
     return
 def __init__(self, activity, toon, position, team):
     self.activity = activity
     self.position = position
     self.toon = toon
     self.team = team
     self.netTimeSentToStartByHit = 0
     self.kaboomTrack = None
     self.locator = None
     self.teamSpot = self.activity.getIndex(self.toon.doId, self.team)
     splatName = 'splat-creampie'
     self.splat = globalPropPool.getProp(splatName)
     self.splat.setBillboardPointEye()
     self.splatType = globalPropPool.getPropType(splatName)
     self.pieHitSound = globalBattleSoundCache.getSound('AA_wholepie_only.ogg')
     return
 def __init__(self, parent = hidden, fBillboard = 1, wantSound = 0):
     NodePath.__init__(self)
     self.assign(globalPropPool.getProp('suit_explosion_dust'))
     if fBillboard:
         self.setBillboardAxis()
     self.reparentTo(parent)
     self.seqNode = self.find('**/+SequenceNode').node()
     self.seqNode.setFrameRate(0)
     self.wantSound = wantSound
     if self.wantSound and not DustCloud.sounds:
         DustCloud.sounds[SFX.poof] = loader.loadSfx(SFXPATHS[SFX.poof])
     self.track = None
     self.trackId = DustCloud.dustCloudCount
     DustCloud.dustCloudCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
 def __init__(self, parent=hidden, fBillboard=1, wantSound=0):
     NodePath.__init__(self)
     self.assign(globalPropPool.getProp('suit_explosion_dust'))
     if fBillboard:
         self.setBillboardAxis()
     self.reparentTo(parent)
     self.seqNode = self.find('**/+SequenceNode').node()
     self.seqNode.setFrameRate(0)
     self.wantSound = wantSound
     if self.wantSound and not DustCloud.sounds:
         DustCloud.sounds[SFX.poof] = loader.loadSfx(SFXPATHS[SFX.poof])
     self.track = None
     self.trackId = DustCloud.dustCloudCount
     DustCloud.dustCloudCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
示例#22
0
 def __init__(self, cogIndex, suitType, game, cogSpeed):
     self.cogIndex = cogIndex
     self.suitType = suitType
     self.game = game
     self.cogSpeed = cogSpeed
     suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     d.newSuit(suitType)
     suit.setDNA(d)
     suit.pose('walk', 0)
     self.suit = suit
     self.goal = CTGG.NoGoal
     self.goalId = CTGG.InvalidGoalId
     self.lastLocalTimeStampFromAI = 0
     self.lastPosFromAI = Point3(0, 0, 0)
     self.lastThinkTime = 0
     self.doneAdjust = False
     self.barrel = CTGG.NoBarrelCarried
     self.signalledAtReturnPos = False
     self.defaultPlayRate = 1.0
     self.netTimeSentToStartByHit = 0
     self.velocity = Vec3(0, 0, 0)
     self.oldVelocity = Vec3(0, 0, 0)
     self.acceleration = Vec3(0, 0, 0)
     self.bodyLength = self.CollisionRadius * 2
     self.cruiseDistance = 2 * self.bodyLength
     self.maxVelocity = self.cogSpeed
     self.maxAcceleration = 5.0
     self.perceptionRange = 10
     self.notify.debug('cogSpeed=%s' % self.cogSpeed)
     self.kaboomSound = loader.loadSfx(
         'phase_4/audio/sfx/MG_cannon_fire_alt.ogg')
     self.kaboom = loader.loadModel(
         'phase_4/models/minigames/ice_game_kaboom')
     self.kaboom.setScale(2.0)
     self.kaboom.setBillboardPointEye()
     self.kaboom.hide()
     self.kaboomTrack = None
     self.explodeTrack = None
     splatName = 'splat-creampie'
     self.splat = globalPropPool.getProp(splatName)
     self.splat.setBillboardPointEye()
     self.splatType = globalPropPool.getPropType(splatName)
     self.pieHitSound = globalBattleSoundCache.getSound(
         'AA_wholepie_only.ogg')
     return
    def load(self):
        self.head = loader.loadModel(self.filePrefix + '-head-zero')

        for anim in AnimList:
            self.animDict[anim] = '%s-%s-%s' % (GenericModel, 'head', anim)

        self.headActor = Actor(self.head, self.animDict)
        self.headActor.hide()
        self.headActor.setBin("fixed", 40)
        self.headActor.setDepthTest(True)
        self.headActor.setDepthWrite(True)

        self.headActor.reparentTo(self)
        self.headActor.setHpr(-90, 0, 270)
        self.headActor.setScale(0.021)
        self.headActor.setPos(-0.25, 0.0, 0.75)
        self.headActor.setPlayRate(2.0, 'turn2Fb')
        self.headActor.loop('Ff_neutral')

        self.eyes = loader.loadModel('phase_10/models/cogHQ/CashBotBossEyes.bam')
        self.eyes.setPosHprScale(4.5, 0, -2.5, 90, 90, 0, 0.4, 0.4, 0.4)
        self.eyes.reparentTo(self.headActor)
        self.eyes.hide()

        self.stars = globalPropPool.getProp('stun')
        self.stars.setPosHprScale(7, 0, 0, 0, 0, -90, 3, 3, 3)
        self.stars.loop('stun')

        self.safe = loader.loadModel('phase_10/models/cogHQ/CBSafe.bam')
        self.safe.reparentTo(self.headActor)
        self.safe.setPosHpr(-1, 0, 0.2, 0, -90, 90)
        self.safe.setBin("fixed", 40)
        self.safe.setDepthTest(True)
        self.safe.setDepthWrite(True)
        self.safe.hide()

        self.headActor.show()

        self.healthBar = DirectWaitBar(parent=self, pos=(0, 0, 0.85), relief=DGG.SUNKEN,
                                       frameSize=(-1.75, 1.75, -0.3, 0.3),
                                       borderWidth=(0.02, 0.02), scale=0.1, range=1, sortOrder=50,
                                       frameColor=(0.5, 0.5, 0.5, 0.5), barColor=(0.75, 0.75, 1.0, 0.8), text='',
                                       text_scale=0.35, text_fg=(1, 1, 1, 1), text_align=TextNode.ACenter,
                                       text_pos=(0, -0.05), text_font=getSuitFont())

        self.updateHealthBar(self.maxHp)
示例#24
0
 def __init__(self, parent = hidden):
     """__init()"""
     # Initialize the superclass
     NodePath.__init__(self)
     # Make yourself a copy of the ripples texture flip
     self.assign(globalPropPool.getProp('ripples'))
     self.reparentTo(parent)
     # Move the tflip slightly above origin to avoid coincident polys
     self.getChild(0).setZ(0.1)
     self.seqNode = self.find('**/+SequenceNode').node()
     self.seqNode.setPlayRate(0)
     # This will hold an interval to play back the tflip
     self.track = None
     self.trackId = Ripples.rippleCount
     # Increment instance counter
     Ripples.rippleCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
示例#25
0
    def setRightHand(self, prop):
        if self.getIsTransformed():
            geom = self.getActiveTransformation()
            rightHand = geom.rightHand
        else:
            rightHand = self.find('**/rightHand')
        if prop == '':
            for child in rightHand.getChildren():
                child.removeNode()

        else:
            for child in rightHand.getChildren():
                child.removeNode()

        if globalPropPool.propTypes.get(prop, None) or prop in Variants:
            requestedProp = globalPropPool.getProp(prop)
            requestedProp.reparentTo(rightHand)
        return
 def __init__(self, cogIndex, suitType, game, cogSpeed):
     self.cogIndex = cogIndex
     self.suitType = suitType
     self.game = game
     self.cogSpeed = cogSpeed
     suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     d.newSuit(suitType)
     suit.setDNA(d)
     suit.pose('walk', 0)
     self.suit = suit
     self.goal = CTGG.NoGoal
     self.goalId = CTGG.InvalidGoalId
     self.lastLocalTimeStampFromAI = 0
     self.lastPosFromAI = Point3(0, 0, 0)
     self.lastThinkTime = 0
     self.doneAdjust = False
     self.barrel = CTGG.NoBarrelCarried
     self.signalledAtReturnPos = False
     self.defaultPlayRate = 1.0
     self.netTimeSentToStartByHit = 0
     self.velocity = Vec3(0, 0, 0)
     self.oldVelocity = Vec3(0, 0, 0)
     self.acceleration = Vec3(0, 0, 0)
     self.bodyLength = self.CollisionRadius * 2
     self.cruiseDistance = 2 * self.bodyLength
     self.maxVelocity = self.cogSpeed
     self.maxAcceleration = 5.0
     self.perceptionRange = 10
     self.notify.debug('cogSpeed=%s' % self.cogSpeed)
     self.kaboomSound = loader.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.ogg')
     self.kaboom = loader.loadModel('phase_4/models/minigames/ice_game_kaboom')
     self.kaboom.setScale(2.0)
     self.kaboom.setBillboardPointEye()
     self.kaboom.hide()
     self.kaboomTrack = None
     self.explodeTrack = None
     splatName = 'splat-creampie'
     self.splat = globalPropPool.getProp(splatName)
     self.splat.setBillboardPointEye()
     self.splatType = globalPropPool.getPropType(splatName)
     self.pieHitSound = globalBattleSoundCache.getSound('AA_wholepie_only.ogg')
     return
    def __showSplat(self, position):
        if self.kaboomTrack is not None and self.kaboomTrack.isPlaying():
            self.kaboomTrack.finish()
        if not self.pieHitSound:
            self.notify.warning('Trying to play hit sound on destroyed player')
            return
        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()
        self.splat.reparentTo(render)
        self.splat.setPos(self.toon, position)
        self.splat.setY(self.toon, bound(self.splat.getY(), self.toon.getHeight() / 2.0, position.getY()))
        self.splat.setAlphaScale(1.0)
        targetscale = 0.75

        def setSplatAlpha(amount):
            self.splat.setAlphaScale(amount)

        self.kaboomTrack = Parallel(SoundInterval(self.pieHitSound, node=self.toon, volume=1.0, cutOff=PartyGlobals.PARTY_COG_CUTOFF), Sequence(Func(self.splat.showThrough), Parallel(Sequence(LerpScaleInterval(self.splat, duration=0.175, scale=targetscale, startScale=Point3(0.1, 0.1, 0.1), blendType='easeOut'), Wait(0.175)), Sequence(Wait(0.1), LerpFunc(setSplatAlpha, duration=1.0, fromData=1.0, toData=0.0, blendType='easeOut'))), Func(self.splat.cleanup), Func(self.splat.removeNode)))
        self.kaboomTrack.start()
        return
示例#28
0
    def _PartyCogActivityPlayer__showSplat(self, position):
        if self.kaboomTrack is not None and self.kaboomTrack.isPlaying():
            self.kaboomTrack.finish()
        
        if not self.pieHitSound:
            self.notify.warning('Trying to play hit sound on destroyed player')
            return None
        
        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()
        self.splat.reparentTo(render)
        self.splat.setPos(self.toon, position)
        self.splat.setY(self.toon, bound(self.splat.getY(), self.toon.getHeight() / 2.0, position.getY()))
        self.splat.setAlphaScale(1.0)
        targetscale = 0.75
        
        def setSplatAlpha(amount):
            self.splat.setAlphaScale(amount)

        self.kaboomTrack = Parallel(SoundInterval(self.pieHitSound, node = self.toon, volume = 1.0, cutOff = PartyGlobals.PARTY_COG_CUTOFF), Sequence(Func(self.splat.showThrough), Parallel(Sequence(LerpScaleInterval(self.splat, duration = 0.17499999999999999, scale = targetscale, startScale = Point3(0.10000000000000001, 0.10000000000000001, 0.10000000000000001), blendType = 'easeOut'), Wait(0.17499999999999999)), Sequence(Wait(0.10000000000000001), LerpFunc(setSplatAlpha, duration = 1.0, fromData = 1.0, toData = 0.0, blendType = 'easeOut'))), Func(self.splat.cleanup), Func(self.splat.removeNode)))
        self.kaboomTrack.start()
示例#29
0
 def __init__(self, parent = hidden):
     """__init()"""
     # Initialize the superclass
     NodePath.__init__(self)
     # Make yourself a copy of the wake texture flip
     self.assign(globalPropPool.getProp('wake'))
     self.reparentTo(parent)
     # Move the tflip slightly above origin to avoid coincident polys
     tformNode = self.getChild(0)
     tformNode.setZ(0.1)
     self.startNodePath = self.find('**/+SequenceNode')
     self.startSeqNode = self.startNodePath.node()
     self.startSeqNode.setName('start')
     self.startSeqNode.setPlayRate(0)
     # Create two more sequence Nodes to hold the different parts of
     # the effect (start, cycle, end)
     # cycle sequence
     self.cycleNodePath = NodePath(SequenceNode(0, 'cycle'))
     self.cycleNodePath.reparentTo(tformNode)
     self.cycleSeqNode = self.cycleNodePath.node()
     # end sequence
     self.endNodePath = NodePath(SequenceNode(0, 'end'))
     self.endNodePath.reparentTo(tformNode)
     self.endSeqNode = self.endNodePath.node()
     # Copy appropriate frames to the cycle and end sequence
     children = self.startNodePath.getChildren()
     for child in children[12:16]:
         child.reparentTo(self.cycleNodePath)
     for child in children[16:]:
         child.reparentTo(self.endNodePath)
     # This will hold an interval to play back the tflip
     self.tracks = []
     self.rate = None
     self.trackId = Wake.wakeCount
     # Increment instance counter
     Wake.wakeCount += 1
     self.setBin('fixed', 10, 1)
     self.hide()
示例#30
0
 def __init__(self, parent=hidden, wantParticles=1):
     NodePath.__init__(self, parent)
     self.assign(parent.attachNewNode('splash'))
     self.splashdown = globalPropPool.getProp('splashdown')
     self.splashdown.reparentTo(self)
     self.splashdown.setZ(-0.01)
     self.splashdown.setScale(0.4)
     ta = TransparencyAttrib.make(TransparencyAttrib.MBinary)
     self.splashdown.node().setAttrib(ta, 1)
     self.splashdown.setBin('fixed', 130, 1)
     self.ripples = Ripples(self)
     self.ripples.setBin('fixed', 120, 1)
     self.wantParticles = 1
     if self.wantParticles:
         self.pSystem = BattleParticles.createParticleEffect('SplashLines')
         self.pSystem.setScale(0.4)
         self.pSystem.setBin('fixed', 150, 1)
         self.particles = self.pSystem.particlesDict.get('particles-1')
     self.track = None
     self.trackId = Splash.splashCount
     Splash.splashCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
 def __init__(self, parent = hidden, wantParticles = 1):
     NodePath.__init__(self, parent)
     self.assign(parent.attachNewNode('splash'))
     self.splashdown = globalPropPool.getProp('splashdown')
     self.splashdown.reparentTo(self)
     self.splashdown.setZ(-0.01)
     self.splashdown.setScale(0.4)
     ta = TransparencyAttrib.make(TransparencyAttrib.MBinary)
     self.splashdown.node().setAttrib(ta, 1)
     self.splashdown.setBin('fixed', 130, 1)
     self.ripples = Ripples(self)
     self.ripples.setBin('fixed', 120, 1)
     self.wantParticles = 1
     if self.wantParticles:
         self.pSystem = BattleParticles.createParticleEffect('SplashLines')
         self.pSystem.setScale(0.4)
         self.pSystem.setBin('fixed', 150, 1)
         self.particles = self.pSystem.particlesDict.get('particles-1')
     self.track = None
     self.trackId = Splash.splashCount
     Splash.splashCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
    def __showSplat(self, position, direction, hot = False):
        if self.kaboomTrack is not None and self.kaboomTrack.isPlaying():
            self.kaboomTrack.finish()
        self.clearHitInterval()
        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()
        self.splat.reparentTo(render)
        self.splat.setPos(self.root, position)
        self.splat.setAlphaScale(1.0)
        if not direction == 1.0:
            self.splat.setColorScale(PartyGlobals.CogActivitySplatColors[0])
            if self.currentFacing > 0.0:
                facing = 'HitFront'
            else:
                facing = 'HitBack'
        else:
            self.splat.setColorScale(PartyGlobals.CogActivitySplatColors[1])
            if self.currentFacing > 0.0:
                facing = 'HitBack'
            else:
                facing = 'HitFront'
        if hot:
            targetscale = 0.75
            part = 'head'
        else:
            targetscale = 0.5
            part = 'body'

        def setSplatAlpha(amount):
            self.splat.setAlphaScale(amount)

        self.hitInterval = Sequence(ActorInterval(self.actor, part + facing, loop=0), Func(self.actor.loop, 'idle'))
        self.hitInterval.start()
        self.kaboomTrack = Parallel(SoundInterval(self.pieHitSound, volume=1.0, node=self.actor, cutOff=PartyGlobals.PARTY_COG_CUTOFF), Sequence(Func(self.splat.showThrough), Parallel(Sequence(LerpScaleInterval(self.splat, duration=0.175, scale=targetscale, startScale=Point3(0.1, 0.1, 0.1), blendType='easeOut'), Wait(0.175)), Sequence(Wait(0.1), LerpFunc(setSplatAlpha, duration=1.0, fromData=1.0, toData=0.0, blendType='easeOut'))), Func(self.splat.cleanup), Func(self.splat.removeNode)))
        self.kaboomTrack.start()
        return
示例#33
0
    def load(self):
        self.root = NodePath("PartyCog-%d" % self.id)
        self.root.reparentTo(self.parentNode)

        path = "phase_13/models/parties/cogPinata_"
        self.actor = Actor(
            path + "actor", {
                "idle": path + "idle_anim",
                "down": path + "down_anim",
                "up": path + "up_anim",
                "bodyHitBack": path + "bodyHitBack_anim",
                "bodyHitFront": path + "bodyHitFront_anim",
                "headHitBack": path + "headHitBack_anim",
                "headHitFront": path + "headHitFront_anim",
            })
        self.actor.reparentTo(self.root)

        self.temp_transform = Mat4()
        self.head_locator = self.actor.attachNewNode("temphead")

        self.bodyColl = CollisionTube(0, 0, 1, 0, 0, 5.75, 0.75)
        self.bodyColl.setTangible(1)
        self.bodyCollNode = CollisionNode("PartyCog-%d-Body-Collision" %
                                          self.id)
        self.bodyCollNode.setCollideMask(ToontownGlobals.PieBitmask)
        self.bodyCollNode.addSolid(self.bodyColl)
        self.bodyCollNodePath = self.root.attachNewNode(self.bodyCollNode)

        self.headColl = CollisionTube(0, 0, 3, 0, 0, 3.0, 1.5)
        self.headColl.setTangible(1)
        self.headCollNode = CollisionNode("PartyCog-%d-Head-Collision" %
                                          self.id)
        self.headCollNode.setCollideMask(ToontownGlobals.PieBitmask)
        self.headCollNode.addSolid(self.headColl)
        self.headCollNodePath = self.root.attachNewNode(self.headCollNode)

        # Cog's Left Arm
        self.arm1Coll = CollisionSphere(1.65, 0, 3.95, 1.0)
        self.arm1Coll.setTangible(1)
        self.arm1CollNode = CollisionNode("PartyCog-%d-Arm1-Collision" %
                                          self.id)
        self.arm1CollNode.setCollideMask(ToontownGlobals.PieBitmask)
        self.arm1CollNode.addSolid(self.arm1Coll)
        self.arm1CollNodePath = self.root.attachNewNode(self.arm1CollNode)

        # Cog's Right Arm
        self.arm2Coll = CollisionSphere(-1.65, 0, 3.45, 1.0)
        self.arm2Coll.setTangible(1)
        self.arm2CollNode = CollisionNode("PartyCog-%d-Arm2-Collision" %
                                          self.id)
        self.arm2CollNode.setCollideMask(ToontownGlobals.PieBitmask)
        self.arm2CollNode.addSolid(self.arm2Coll)
        self.arm2CollNodePath = self.root.attachNewNode(self.arm2CollNode)

        splatName = 'splat-creampie'
        self.splat = globalPropPool.getProp(splatName)
        self.splat.setBillboardPointEye()
        self.splatType = globalPropPool.getPropType(splatName)

        self.pieHitSound = globalBattleSoundCache.getSound(
            'AA_wholepie_only.mp3')
        self.upSound = globalBattleSoundCache.getSound('AV_jump_to_side.mp3')

        self.hole = loader.loadModel("phase_13/models/parties/cogPinataHole")
        self.hole.setTransparency(True)
        self.hole.setP(-90.0)
        self.hole.setScale(3)
        self.hole.setBin("ground", 3)
        self.hole.reparentTo(self.parentNode)