def __init__(self, cr):
        DistributedEvent.__init__(self, cr)
        self.cr = cr
        self.spark = loader.loadSfx('phase_11/audio/sfx/LB_sparks_1.ogg'
                                    )  # i think this could be used somewhere

        # Create prepostera
        self.prepostera = Toon.Toon()
        self.prepostera.setName('Professor Prepostera')
        self.prepostera.setPickable(0)
        self.prepostera.setPlayerType(NametagGlobals.CCNonPlayer)
        dna = ToonDNA.ToonDNA()
        dna.newToonFromProperties('hss', 'ms', 'm', 'm', 20, 0, 20, 20, 97, 27,
                                  86, 27, 37, 27)
        self.prepostera.setDNA(dna)
        self.prepostera.loop('scientistEmcee')
        self.prepostera.reparentTo(render)
        self.prepostera.setPosHpr(4, -3, 1, 0, 0, 0)
        self.prepostera.blinkEyes()
        self.prepostera.head = self.prepostera.find('**/__Actor_head')
        self.prepostera.initializeBodyCollisions('toon')

        self.headHoncho1 = DistributedSuitBase.DistributedSuitBase(self.cr)
        headHoncho1suitDNA = SuitDNA.SuitDNA()
        headHoncho1suitDNA.newSuit('hho')
        self.headHoncho1.setDNA(headHoncho1suitDNA)
        self.headHoncho1.setDisplayName('???')
        self.headHoncho1.setPickable(0)
        self.headHoncho1.setPosHpr(0, 0, 0, 0, 0, 0)
        self.headHoncho1.reparentTo(render)
        self.headHoncho1.doId = 0
        self.headHoncho1.hide()
        self.headHoncho1.initializeBodyCollisions('toon')

        middlemanDNA = SuitDNA.SuitDNA()
        middlemanDNA.newSuit('mdm')

        self.middleman1 = DistributedSuitBase.DistributedSuitBase(self.cr)
        self.middleman1.setDNA(middlemanDNA)
        self.middleman1.setDisplayName('Middleman')
        self.middleman1.setPickable(0)
        self.middleman1.setPosHpr(0, 0, 0, 0, 0, 0)
        self.middleman1.reparentTo(render)
        self.middleman1.doId = 1
        self.middleman1.hide()
        self.middleman1.initializeBodyCollisions('toon')

        self.middleman2 = DistributedSuitBase.DistributedSuitBase(self.cr)
        self.middleman2.setDNA(middlemanDNA)
        self.middleman2.setDisplayName('Middleman')
        self.middleman2.setPickable(0)
        self.middleman2.setPosHpr(0, 0, 0, 0, 0, 0)
        self.middleman2.reparentTo(render)
        self.middleman2.doId = 2
        self.middleman2.hide()
        self.middleman2.initializeBodyCollisions('toon')

        #base.musicManager.stopAllSounds()
        self.toonMusic = loader.loadMusic(
            'phase_14/audio/bgm/tt2_ambient_1.mp3')  # Placeholder
Exemplo n.º 2
0
    def loadVirtualSuit(self):
        dna = SuitDNA.SuitDNA()
        dna.newSuit(self.getSuitName())
        self.virtualSuit = Suit.Suit()
        self.virtualSuit.reparentTo(self)
        self.virtualSuit.setDNA(dna)
        self.virtualSuit.setPos(self, 0.0, 2.5, 0.0)
        self.virtualSuit.makeSkeleton(wantNameInfo=False)
        self.virtualSuit.makeVirtual()
        self.virtualSuit.hideName()
        anims = self.generateSuitAnimDict()
        self.virtualSuit.loadAnims(anims)
        self.virtualSuit.loop('walk', 0)

        synergyBox = CollisionBox(0, 3.5, 10, 1)
        synergyBox.setTangible(0)
        synergyNode = CollisionNode(self.uniqueName('SynergyAttack'))
        synergyNode.setTag('damage', '10')
        synergyNode.addSolid(synergyBox)
        synergyNode.setIntoCollideMask(WallBitmask)
        self.synergyColl = self.virtualSuit.attachNewNode(synergyNode)
        self.synergyColl.setPos(0.0, 9.0, 0.0)
        self.synergyColl.stash()

        self.synergySfx = loader.loadSfx('phase_5/audio/sfx/SA_synergy.ogg')
        self.teeOffSfx = loader.loadSfx('phase_5/audio/sfx/SA_tee_off.ogg')
        self.writeOffSfx = loader.loadSfx(
            'phase_5/audio/sfx/SA_writeoff_pen_only.ogg')
        self.dingSfx = loader.loadSfx(
            'phase_5/audio/sfx/SA_writeoff_ding_only.ogg')
 def __init__(self, air, dept):
     DistributedAvatarAI.DistributedAvatarAI.__init__(self, air)
     self.dept = dept
     self.dna = SuitDNA.SuitDNA()
     self.dna.newBossCog(self.dept)
     self.deptIndex = SuitDNA.suitDepts.index(self.dept)
     self.resetBattleCounters()
     self.looseToons = []
     self.involvedToons = []
     self.begunSolo = False
     self.punishedToons = []
     self.toonsA = []
     self.toonsB = []
     self.nearToons = []
     self.suitsA = []
     self.activeSuitsA = []
     self.suitsB = []
     self.activeSuitsB = []
     self.reserveSuits = []
     self.barrier = None
     self.keyStates = ['BattleOne',
      'BattleTwo',
      'BattleThree',
      'Victory']
     self.bossDamage = 0
     self.battleThreeStart = 0
     self.battleThreeDuration = 1800
     self.attackCode = None
     self.attackAvId = 0
     self.hitCount = 0
     AllBossCogs.append(self)
Exemplo n.º 4
0
    def __init__(self, air):
        DistributedSuitBaseAI.__init__(self, air, None)

        suitDNA = SuitDNA.SuitDNA()
        suitDNA.newSuit('f')
        self.dna = suitDNA
        self.setLevel(1)
Exemplo n.º 5
0
 def generate(self):
     self.cart = loader.loadModel(self.cartModelPath)
     self.cart.reparentTo(render)
     self.cartBody = self.cart.find('**/main_body')
     self.cartBase = self.cart.find('**/cart_base*')
     self.cartBody.setColorScale(0.8, 0.1, 0.1, 1)
     self.cartBase.setColorScale(0.1, 0.8, 0.1, 1)
     self.swag = Suit.Suit()
     self.swag.dna = SuitDNA.SuitDNA()
     self.swag.dna.newSuit('sf')
     self.swag.setDNA(self.swag.dna)
     self.swag.setName("Smokin' Claus")
     nameInfo = TTLocalizer.SuitBaseNameWithLevel % {'name': "Smokin' Claus", 'dept': TTLocalizer.Sellbot, 
        'level': 50}
     self.swag.setDisplayName(nameInfo)
     self.swag.setPickable(False)
     self.swag.addActive()
     self.collTube = CollisionTube(0, 0, 0.5, 0, 0, 4, 4)
     self.collNode = CollisionNode('suit')
     self.collNode.addSolid(self.collTube)
     self.collNodePath = self.swag.attachNewNode(self.collNode)
     self.swag.loop('sit')
     self.swag.setScale(0.7)
     self.swag.setH(180)
     self.swag.setPos(0, -1, -1.5)
     self.swag.reparentTo(self.cart.find('**/seat1'))
 def parseLoadSuit(self, line):
     token, name, suitType = line
     suit = Suit.Suit()
     dna = SuitDNA.SuitDNA()
     dna.newSuit(suitType)
     suit.setDNA(dna)
     self.setVar(name, suit)
Exemplo n.º 7
0
def attachSuitHead(node, suitName):
    suitIndex = SuitDNA.suitHeadTypes.index(suitName)
    suitDNA = SuitDNA.SuitDNA()
    suitDNA.newSuit(suitName)
    suit = Suit()
    suit.setDNA(suitDNA)
    headParts = suit.getHeadParts()
    head = node.attachNewNode('head')
    for part in headParts:
        copyPart = part.copyTo(head)
        copyPart.setDepthTest(1)
        copyPart.setDepthWrite(1)

    suit.delete()
    suit = None
    p1 = Point3()
    p2 = Point3()
    head.calcTightBounds(p1, p2)
    d = p2 - p1
    biggest = max(d[0], d[2])
    column = suitIndex % SuitDNA.suitsPerDept
    s = (0.2 + column / 100.0) / biggest
    pos = -0.14 + (SuitDNA.suitsPerDept - column - 1) / 135.0
    head.setPosHprScale(0, 0, pos, 180, 0, 0, s, s, s)
    return head
Exemplo n.º 8
0
def createCog(cogType,
              x=0,
              y=0,
              z=0,
              h=0,
              p=0,
              r=0,
              isSkelecog=False,
              isWaiter=False,
              anim='neutral',
              parent=render,
              name=None,
              dept=None,
              level=None,
              coll=True):
    newCog = Suit.Suit()
    newCog.dna = SuitDNA.SuitDNA()
    newCog.dna.newSuit(cogType)
    newCog.setDNA(newCog.dna)
    newCog.setPickable(0)
    if isWaiter:
        newCog.makeWaiter()
    if isSkelecog:
        newCog.makeSkeleton(True)
        newCog.setName(TTLocalizer.Skeleton)
    if name != None:
        newCog.setName(name)
    if dept is False:
        nameInfo = TTLocalizer.SuitBaseNameWithoutDept % {
            'name': newCog._name,
            'level': level if level != None else newCog.getActualLevel()
        }
    else:
        if cogType == 'sj':
            nameInfo = 'Shadow Justice'
        else:
            if cogType == 'ph':
                nameInfo = TTLocalizer.SuitBaseNameWithLevel % {
                    'name': newCog._name,
                    'dept': 'Crazybot',
                    'level':
                    level if level != None else newCog.getActualLevel()
                }
            else:
                nameInfo = TTLocalizer.SuitBaseNameWithLevel % {
                    'name': newCog._name,
                    'dept': dept if dept != None else newCog.getStyleDept(),
                    'level':
                    level if level != None else newCog.getActualLevel()
                }
    newCog.reparentTo(parent)
    newCog.setPosHpr(x, y, z, h, p, r)
    newCog.loop(anim)
    newCog.setDisplayName(nameInfo)
    if coll:
        collTube = CollisionTube(0, 0, 0.5, 0, 0, 4, 2)
        collNode = CollisionNode('suit')
        collNode.addSolid(collTube)
        collNodePath = newCog.attachNewNode(collNode)
    return newCog
 def __init__(self, cr):
     DistributedEvent.__init__(self, cr)
     self.cr = cr
     self.spark = loader.loadSfx('phase_11/audio/sfx/LB_sparks_1.ogg')
     self.prepostera = Toon.Toon()
     self.prepostera.setName('Professor Prepostera')
     self.prepostera.setPickable(0)
     self.prepostera.setPlayerType(NametagGlobals.CCNonPlayer)
     dna = ToonDNA.ToonDNA()
     dna.newToonFromProperties('hss', 'ms', 'm', 'm', 20, 0, 20, 20, 97, 27,
                               86, 27, 37, 27)
     self.prepostera.setDNA(dna)
     self.prepostera.loop('scientistEmcee')
     self.prepostera.reparentTo(render)
     self.prepostera.setPosHpr(68, -10, 4.024, 75, 0, 0)
     self.prepostera.blinkEyes()
     self.prepostera.head = self.prepostera.find('**/__Actor_head')
     self.prepostera.initializeBodyCollisions('toon')
     self.headHoncho1 = DistributedSuitBase.DistributedSuitBase(self.cr)
     headHoncho1suitDNA = SuitDNA.SuitDNA()
     headHoncho1suitDNA.newSuit('hho')
     self.headHoncho1.setDNA(headHoncho1suitDNA)
     self.headHoncho1.setDisplayName('???')
     self.headHoncho1.setPickable(0)
     self.headHoncho1.setPosHpr(0, 0, 0, 0, 0, 0)
     self.headHoncho1.reparentTo(render)
     self.headHoncho1.doId = 0
     self.headHoncho1.hide()
     self.headHoncho1.initializeBodyCollisions('toon')
     self.toonMusic = loader.loadMusic(
         'phase_14/audio/bgm/tt2_ambient_1.mp3')
     self.invasion1 = loader.loadMusic(
         'phase_14/audio/bgm/event_temp_1.ogg')
Exemplo n.º 10
0
    def load(self):
        CogdoGameMovie.load(self)
        self.toonDNA = ToonDNA.ToonDNA()
        self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2,
                                           1, 8, 1, 8, 1, 14)
        self.toonHead = Toon.Toon()
        self.toonHead.setDNA(self.toonDNA)
        self.makeSuit('sc')
        self.toonHead.getGeomNode().setDepthWrite(1)
        self.toonHead.getGeomNode().setDepthTest(1)
        self.toonHead.loop('neutral')
        self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18,
                                     0.18)
        self.toonHead.reparentTo(hidden)
        self.toonHead.startBlink()
        self.cogHead = Suit.Suit()
        self.cogDNA = SuitDNA.SuitDNA()
        self.cogDNA.newSuit('le')
        self.cogHead.setDNA(self.cogDNA)
        self.cogHead.getGeomNode().setDepthWrite(1)
        self.cogHead.getGeomNode().setDepthTest(1)
        self.cogHead.loop('neutral')
        self.cogHead.setPosHprScale(-0.74, 0, -1.79, 180, 0, 0, 0.12, 0.14,
                                    0.14)
        self.cogHead.reparentTo(hidden)
        self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip'))
        self.clipPlane.node().setPlane(Plane(0, 0, 1, 0))
        self.clipPlane.setPos(0, 0, 2.45)
        audioMgr = base.cogdoGameAudioMgr
        self._cogDialogueSfx = audioMgr.createSfx('cogDialogue')
        self._toonDialogueSfx = audioMgr.createSfx('toonDialogue')

        def start():
            camera.wrtReparentTo(render)
            self._startUpdateTask()

        def end():
            self._stopUpdateTask()

        introDuration = Globals.Gameplay.IntroDurationSeconds
        dialogue = TTLocalizer.CogdoFlyingIntroMovieDialogue
        waitDur = introDuration / len(dialogue)
        flyDur = introDuration - waitDur * 0.5
        flyThroughIval = Parallel(
            camera.posInterval(flyDur,
                               self._exit.getPos(render) + Point3(0, -22, 1),
                               blendType='easeInOut'),
            camera.hprInterval(flyDur, Point3(0, 5, 0), blendType='easeInOut'))
        self._ival = Sequence(
            Func(start),
            Parallel(
                flyThroughIval,
                Sequence(
                    Func(self.displayLine, 'cog',
                         self._getRandomLine(dialogue[0])), Wait(waitDur),
                    Func(self.displayLine, 'toon',
                         self._getRandomLine(dialogue[1])), Wait(waitDur),
                    Func(self.displayLine, 'cog',
                         self._getRandomLine(dialogue[2])), Wait(waitDur))),
            Func(end))
 def loadCogJuror(self):
     self.cleanupCogJuror()
     self.cogJuror = Suit.Suit()
     level = self.randomGenerator.randrange(len(SuitDNA.suitsPerLevel))
     suitDepts = ['c', 'l', 'm', 's', 'g']
     dept = self.randomGenerator.choice(suitDepts)
     self.cogJuror.dna = SuitDNA.SuitDNA()
     self.invCog = base.cr.newsManager.getInvadingSuit()
     if self.invCog:
         self.cogJuror.dna.newSuit(self.invCog)
     else:
         self.cogJuror.dna.newSuitRandom(level=level, dept=dept)
     self.cogJuror.setDNA(self.cogJuror.dna)
     self.cogJuror.pose('landing', 0)
     self.cogJuror.reparentTo(self.nodePath)
     self.cogJuror.prop = None
     if self.cogJuror.prop == None:
         self.cogJuror.prop = BattleProps.globalPropPool.getProp(
             'propeller')
     head = self.cogJuror.find('**/joint_head')
     self.cogJuror.prop.reparentTo(head)
     self.propTrack = Sequence(
         ActorInterval(self.cogJuror.prop,
                       'propeller',
                       startFrame=8,
                       endFrame=25))
     self.cogJuror.nametag3d.stash()
     self.cogJuror.nametag.destroy()
     return
    def __init__(self, air):
        DistributedSuitBaseAI.__init__(self, air, None)

        suitDNA = SuitDNA.SuitDNA()
        suitDNA.newSuit(random.choice(['f', 'bf', 'sc', 'cc', 'ca']))
        self.dna = suitDNA
        self.setLevel(1)
    def __init__(self, index, collSolid, motionPath=None):
        self.prop = None
        self.suit = Suit.Suit()
        d = SuitDNA.SuitDNA()
        d.newSuit(random.choice(Globals.Gameplay.MinionDnaName))

        self.suit.setDNA(d)
        self.suit.setScale(Globals.Gameplay.MinionScale)
        self.suit.nametag3d.stash()
        self.suit.nametag.destroy()
        swapAvatarShadowPlacer(self.suit, 'minion-%sShadowPlacer' % index)
        self.mopathNodePath = NodePath('mopathNodePath')
        self.suit.reparentTo(self.mopathNodePath)
        CogdoFlyingObstacle.__init__(
            self,
            Globals.Level.ObstacleTypes.Minion,
            index,
            self.mopathNodePath,
            collSolid,
            motionPath=motionPath,
            motionPattern=CogdoFlyingObstacle.MotionTypes.Loop,
            blendMotion=False,
            instanceModel=False)
        self.lastPos = None
        self.suit.loop('neutral')
Exemplo n.º 14
0
 def __makeSuit(self, dept, type, name=None):
     dna = SuitDNA.SuitDNA()
     if name != None:
         dna.newSuit(name)
     else:
         dna.newSuitRandom(type + 1, dept)
     suit = Suit.Suit()
     suit.setStyle(dna)
     suit.generateSuit()
     suit.pose('neutral', 30)
     ll = Point3()
     ur = Point3()
     suit.update()
     suit.calcTightBounds(ll, ur)
     suitWidth = ur[0] - ll[0]
     suitDepth = ur[1] - ll[1]
     suitHeight = ur[2] - ll[2]
     self.rowWidth += suitWidth + suitDepth
     self.rowHeight = max(self.rowHeight, suitHeight)
     suit.reparentTo(self.gallery)
     suit.setHpr(180.0, 0.0, 0.0)
     profile = Suit.Suit()
     profile.setStyle(dna)
     profile.generateSuit()
     profile.pose('neutral', 30)
     profile.reparentTo(self.gallery)
     profile.setHpr(90.0, 0.0, 0.0)
     self.suitRow.append((type, suitWidth, suit, suitDepth, profile))
     self.actors.append(suit)
     self.actors.append(profile)
 def __setupSuitInfo(self, suit, bldgTrack, suitLevel, suitType):
     dna = SuitDNA.SuitDNA()
     dna.newSuitRandom(suitType, bldgTrack)
     suit.dna = dna
     self.notify.debug('Creating suit type ' + suit.dna.name + ' of level ' + str(suitLevel) + ' from type ' + str(suitType) + ' and track ' + str(bldgTrack))
     suit.setLevel(suitLevel)
     return False
 def setupSuitDNA(self, level, type, track):
     dna = SuitDNA.SuitDNA()
     dna.newSuitRandom(type, track)
     self.dna = dna
     self.track = track
     self.setLevel(level)
     return None
Exemplo n.º 17
0
 def generate(self):
     DistributedObject.DistributedObject.generate(self)
     self.pumpkin = loader.loadModel('phase_4/models/estate/pumpkin_tall')
     self.spookyCog = Suit.Suit()
     self.spookyCog.dna = SuitDNA.SuitDNA()
     self.spookyCog.dna.newSuit('mh')
     self.spookyCog.setDNA(self.spookyCog.dna)
     self.spookyCog.makeSkeleton(skipName=True)
     head = self.spookyCog.find('**/joint_head')
     self.pumpkin.reparentTo(head)
     self.pumpkin.setPosHprScale(0, 0, -0.125, 180, 0, 0, 0.5, 0.5, 0.5)
     self.pumpkin.find('**/floorShadow_plane').removeNode()
     self.pumpkin.setScale(0.4)
     self.spookyCog.setName('Spooky Skelecog')
     self.spookyCog.setDisplayName('Spooky Skelecog\nLevel 31')
     self.spookyCog.spookify()
     self.spookyCog.setPickable(False)
     self.spookyCog.addActive()
     self.spookyCog.reparentTo(render)
     self.spookyCog.setPos(-23.076, -83.587, 0.525)
     self.spookyCog.loop('neutral')
     cs = CollisionSphere(0, 0, 0, 3)
     self.spookNode = self.spookyCog.attachNewNode(
         CollisionNode('spookycog'))
     self.spookNode.node().addSolid(cs)
     self.colEventName = 'enter' + self.spookNode.node().getName()
     self.accept(self.colEventName, self.handleSpookyCog)
Exemplo n.º 18
0
 def __init__(self, serialNum, maze, randomNumGen, cellWalkPeriod, difficulty, suitDnaName = 'f', startTile = None, ticFreq = MazeGameGlobals.SUIT_TIC_FREQ, walkSameDirectionProb = MazeGameGlobals.WALK_SAME_DIRECTION_PROB, walkTurnAroundProb = MazeGameGlobals.WALK_TURN_AROUND_PROB, uniqueRandomNumGen = True, walkAnimName = None):
     self.serialNum = serialNum
     self.maze = maze
     if uniqueRandomNumGen:
         self.rng = RandomNumGen(randomNumGen)
     else:
         self.rng = randomNumGen
     self.difficulty = difficulty
     self._walkSameDirectionProb = walkSameDirectionProb
     self._walkTurnAroundProb = walkTurnAroundProb
     self._walkAnimName = walkAnimName or 'walk'
     self.suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     d.newSuit(suitDnaName)
     self.suit.setDNA(d)
     self.suit.nametag.setNametag2d(None)
     self.suit.nametag.setNametag3d(None)
     if startTile is None:
         defaultStartPos = MazeGameGlobals.SUIT_START_POSITIONS[self.serialNum]
         self.startTile = (defaultStartPos[0] * self.maze.width, defaultStartPos[1] * self.maze.height)
     else:
         self.startTile = startTile
     self.ticFreq = ticFreq
     self.ticPeriod = int(cellWalkPeriod)
     self.cellWalkDuration = float(self.ticPeriod) / float(self.ticFreq)
     self.turnDuration = 0.6 * self.cellWalkDuration
     return
Exemplo n.º 19
0
 def updateDNA(self, description):
     # Create dna
     if isinstance(description, ToonDNA.ToonDNA):
         dna = description
     else:
         dna = SuitDNA.SuitDNA()
         if isinstance(description, str):
             # Assume it is a suit specification
             dna.newSuit(description)
         elif isinstance(description, int):
             # Assume it specifies suit level
             dna.newSuitRandom(description)
         elif (isinstance(description, list) or
             isinstance(description, tuple)):
             # Assume it is a (level,track) list
             dna.newSuitRandom(description[0], description[1])
         else:
             level = randint(0,7)
             trackVal = random()
             if trackVal < 0.25:
                 track = 'c'
             elif trackVal < 0.5:
                 track = 's'
             elif trackVal < 0.75:
                 track = 'l'
             else:
                 track = 'm'
             dna.newSuitRandom(level, track)
     self.setDNA(dna)
Exemplo n.º 20
0
    def __setupSuitInfo( self, suit, bldgTrack, suitLevel, suitType ):
        """
        create dna information for the given suit with the given track
        and suit type
        """
        suitName, skeleton = simbase.air.suitInvasionManager.getInvadingCog()
        if suitName and self.respectInvasions:
            # Override the suit type
            suitType = SuitDNA.getSuitType(suitName)
            # Override the building track
            bldgTrack = SuitDNA.getSuitDept(suitName)
            # if our type is already specified, we might need to
            # constrain the level to fit.
            suitLevel = min(max(suitLevel, suitType), suitType + 4)

        dna = SuitDNA.SuitDNA()
        dna.newSuitRandom( suitType, bldgTrack )
        suit.dna = dna
        self.notify.debug("Creating suit type " + suit.dna.name +
                          " of level " + str( suitLevel ) +
                          " from type " + str( suitType ) +
                          " and track " + str( bldgTrack ) )
        suit.setLevel( suitLevel )

        # We can't make a suit a skeleton until after generate.
        # Pass this info back so we know whether to do it or not
        return skeleton
Exemplo n.º 21
0
 def enterAttack(self):
     dna = SuitDNA.SuitDNA()
     if self.brain.suit.dna.body in ['a', 'b']:
         self._delay = taskMgr.doMethodLater(4.6, self.__attackDone,
                                             self.uniqueName('attack'))
     else:
         self._delay = taskMgr.doMethodLater(3.3, self.__attackDone,
                                             self.uniqueName('attack'))
Exemplo n.º 22
0
 def initGoon(self, dnaName):
     dna = SuitDNA.SuitDNA()
     dna.newGoon(dnaName)
     self.setDNA(dna)
     self.type = dnaName
     self.createHead()
     self.find('**/actorGeom').setH(180)
     self.nametag3d.hide()
Exemplo n.º 23
0
def createCog(cogType,
              x=0,
              y=0,
              z=0,
              h=0,
              p=0,
              r=0,
              isSkelecog=False,
              isWaiter=False,
              isVirtual=False,
              isSkeleRevive=False,
              colorType=NametagGroup.CCSuit,
              anim='neutral',
              parent=render,
              name=None,
              dept=None,
              level=None,
              coll=True):
    newCog = Suit.Suit()
    newCog.dna = SuitDNA.SuitDNA()
    newCog.dna.newSuit(cogType)
    newCog.setDNA(newCog.dna)
    newCog.setPlayerType(colorType)
    newCog.setPickable(0)
    level = level if level != None else newCog.getActualLevel()
    if isWaiter:
        newCog.makeWaiter()
    if isSkelecog:
        newCog.makeSkeleton()
        newCog.setName(TTLocalizer.Skeleton)
    if isVirtual:
        newCog.makeVirtual()
    if isSkeleRevive:
        level = '%s%s' % (level, TTLocalizer.SkeleRevivePostFix)
    if name != None:
        newCog.setName(name)
    if dept is False:
        nameInfo = TTLocalizer.SuitBaseNameWithoutDept % {
            'name': newCog._name,
            'level': level
        }
    else:
        nameInfo = TTLocalizer.SuitBaseNameWithLevel % {
            'name': newCog._name,
            'dept': dept if dept != None else newCog.getStyleDept(),
            'level': level
        }
    newCog.setPosHpr(x, y, z, h, p, r)
    newCog.reparentTo(parent)
    newCog.loop(anim)
    newCog.setDisplayName(nameInfo)
    if coll:
        collTube = CollisionTube(0, 0, 0.5, 0, 0, 4, 2)
        collNode = CollisionNode('suit')
        collNode.addSolid(collTube)
        newCog.attachNewNode(collNode)
    return newCog
 def createSuit(self):
     self.suit = Suit.Suit()
     suitDNA = SuitDNA.SuitDNA()
     suitDNA.newSuit('f')
     self.suit.setDNA(suitDNA)
     self.suit.loop('neutral')
     self.suit.setPosHpr(-20, 8, 0, 0, 0, 0)
     self.suit.reparentTo(self.interior)
     self.suitWalkTrack = Sequence(self.suit.hprInterval(0.1, Vec3(0, 0, 0)), Func(self.suit.loop, 'walk'), self.suit.posInterval(2, Point3(-20, 20, 0)), Func(self.suit.loop, 'neutral'), Wait(1.0), self.suit.hprInterval(0.1, Vec3(180, 0, 0)), Func(self.suit.loop, 'walk'), self.suit.posInterval(2, Point3(-20, 10, 0)), Func(self.suit.loop, 'neutral'), Wait(1.0))
     self.suitWalkTrack.loop()
Exemplo n.º 25
0
 def __setupSuitInfo(self, suit, bldgTrack, suitLevel, suitType):
     suitName, skeleton = simbase.air.suitInvasionManager.getInvadingCog()
     if suitName and self.respectInvasions:
         suitType = SuitDNA.getSuitType(suitName)
         bldgTrack = SuitDNA.getSuitDept(suitName)
         suitLevel = min(max(suitLevel, suitType), suitType + 4)
     dna = SuitDNA.SuitDNA()
     dna.newSuitRandom(suitType, bldgTrack)
     suit.dna = dna
     self.notify.debug('Creating suit type ' + suit.dna.name + ' of level ' + str(suitLevel) + ' from type ' + str(suitType) + ' and track ' + str(bldgTrack))
     suit.setLevel(suitLevel)
     return skeleton
    def __makeDoobers(self):
        self.__resetDoobers()
        for i in xrange(8):
            suit = DistributedSuitAI.DistributedSuitAI(self.air, None)
            level = random.randrange(len(SuitDNA.suitsPerLevel))
            suit.dna = SuitDNA.SuitDNA()
            suit.dna.newSuitRandom(level=level, dept=self.dna.dept)
            suit.setLevel(level)
            suit.generateWithRequired(self.zoneId)
            self.doobers.append(suit)

        self.__sendDooberIds()
Exemplo n.º 27
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')
Exemplo n.º 28
0
    def setupEnemy(self, suitAttribs):
        suitType = suitAttribs[0]
        self.suit = Suit.Suit()
        suitDNA = SuitDNA.SuitDNA()
        suitDNA.newSuit(suitType)
        self.suit.setDNA(suitDNA)
        self.suit.pose('walk', 0)
        self.suitName = 'Enemy-%s' % self.index
        self.suit.setName(self.suitName)
        self.suit.nametag3d.stash()
        self.suit.nametag.destroy()
        suitPosAttribs = suitAttribs[1]
        initX, initY, initZ = suitPosAttribs[0]
        initPos = Point3(initX, initY, initZ)
        if len(suitPosAttribs) == 3:
            finalX, finalY, finalZ = suitPosAttribs[1]
            finalPos = Point3(finalX, finalY, finalZ)
            posIvalDuration = suitPosAttribs[2]
            self.clearMoveIval()

            def getForwardIval(blendTypeStr, self = self):
                forwardIval = LerpPosInterval(self.suit, posIvalDuration, pos=finalPos, startPos=initPos, name='%s-moveFront' % self.suitName, blendType=blendTypeStr, fluid=1)
                return forwardIval

            def getBackwardIval(blendTypeStr, self = self):
                backwardIval = LerpPosInterval(self.suit, posIvalDuration, pos=initPos, startPos=finalPos, name='%s-moveBack' % self.suitName, blendType=blendTypeStr, fluid=1)
                return backwardIval

            if abs(finalZ - initZ) > 0.0:

                def setIsGoingUp(value):
                    self.isGoingUp = value

                self.isMovingUpDown = True
                self.suit.setH(90)
                self.suit.prop = None
                if self.suit.prop == None:
                    self.suit.prop = BattleProps.globalPropPool.getProp('propeller')
                    self.suit.prop.setScale(1.1)
                    self.suit.prop.setColor(1, 1, 0.6, 1)
                head = self.suit.find('**/joint_head')
                self.suit.prop.reparentTo(head)
                self.propTrack = Sequence(ActorInterval(self.suit.prop, 'propeller', startFrame=8, endFrame=25, playRate=2.0))
                self.animTrack = Sequence(ActorInterval(self.suit, 'landing', startFrame=8, endFrame=28, playRate=0.5), ActorInterval(self.suit, 'landing', startFrame=8, endFrame=28, playRate=-0.5))
                self.moveIval = Sequence(Func(setIsGoingUp, True), getForwardIval('easeInOut'), Func(setIsGoingUp, False), getBackwardIval('easeInOut'))
                self.suitSound = base.loadSfx('phase_4/audio/sfx/TB_propeller.ogg')
            else:
                self.isMovingLeftRight = True
                self.moveIval = Sequence(Func(self.setHeading, finalPos, initPos), getForwardIval('noBlend'), Func(self.setHeading, initPos, finalPos), getBackwardIval('noBlend'))
        self.suit.setPos(initX, initY, initZ)
        self.suit.dropShadow.hide()
        self.setupCollision()
        return
Exemplo n.º 29
0
 def makeSuit(self, suitType):
     suit = Suit.Suit()
     dna = SuitDNA.SuitDNA()
     dna.newSuit(suitType)
     suit.setStyle(dna)
     suit.isDisguised = 1
     suit.generateSuit()
     suit.setScale(1, 1, 2)
     suit.setPos(0, 0, -4.4)
     suit.reparentTo(self.toonHead)
     for part in suit.getHeadParts():
         part.hide()
Exemplo n.º 30
0
 def __init__(self, nest, index, suitDnaName='le'):
     FSM.__init__(self, 'CogdoFlyingLegalEagle')
     self.defaultTransitions = {
         'Off': ['Roost'],
         'Roost': ['TakeOff', 'Off'],
         'TakeOff': ['LockOnToon', 'LandOnNest', 'Off'],
         'LockOnToon': ['RetreatToNest', 'ChargeUpAttack', 'Off'],
         'ChargeUpAttack': ['RetreatToNest', 'Attack', 'Off'],
         'Attack': ['RetreatToSky', 'Off'],
         'RetreatToSky': ['Cooldown', 'Off'],
         'Cooldown': ['LockOnToon', 'LandOnNest', 'Off'],
         'RetreatToNest': ['LandOnNest', 'Off'],
         'LandOnNest': ['Roost', 'Off']
     }
     self.index = index
     self.nest = nest
     self.target = None
     self.isEagleInterested = False
     self.collSphere = None
     self.suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     d.newSuit(suitDnaName)
     self.suit.setDNA(d)
     self.suit.reparentTo(render)
     swapAvatarShadowPlacer(self.suit, 'legalEagle-%sShadowPlacer' % index)
     self.suit.setPos(self.nest.getPos(render))
     self.suit.setHpr(-180, 0, 0)
     self.suit.stash()
     self.prop = None
     self.attachPropeller()
     head = self.suit.find('**/joint_head')
     self.interestConeOrigin = self.nest.attachNewNode('fakeHeadNodePath')
     self.interestConeOrigin.setPos(
         render,
         head.getPos(render) +
         Vec3(0, Globals.LegalEagle.InterestConeOffset, 0))
     self.attackTargetPos = None
     self.startOfRetreatToSkyPos = None
     pathModel = CogdoUtil.loadFlyingModel('legalEaglePaths')
     self.chargeUpMotionPath = Mopath.Mopath(name='chargeUpMotionPath-%i' %
                                             self.index)
     self.chargeUpMotionPath.loadNodePath(pathModel.find('**/charge_path'))
     self.retreatToSkyMotionPath = Mopath.Mopath(
         name='retreatToSkyMotionPath-%i' % self.index)
     self.retreatToSkyMotionPath.loadNodePath(
         pathModel.find('**/retreat_path'))
     audioMgr = base.cogdoGameAudioMgr
     self._screamSfx = audioMgr.createSfx('legalEagleScream', self.suit)
     self.initIntervals()
     self.suit.nametag.setNametag2d(None)
     self.suit.nametag.setNametag3d(None)
     return