def __init__(self, index, collSolid, motionPath=None):
     self.prop = None
     self.suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     invSuit = base.cr.newsManager.getInvadingSuit()
     if invSuit:
         d.newSuit(invSuit)
     else:
         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')
     return
 def __init__(self, index, collSolid, motionPath=None):
     self.prop = None
     self.suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     d.newSuit(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")
     return
Example #3
0
 def __init__(self, nest, index, suitDnaName='le'):
     FSM.__init__(self, 'CogdoFlyingRobberBaron')
     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.isBaronInterested = 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, 'RobberBaron-%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.RobberBaron.InterestConeOffset, 0))
     self.attackTargetPos = None
     self.startOfRetreatToSkyPos = None
     pathModel = CogdoUtil.loadFlyingModel('RobberBaronPaths')
     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('RobberBaronScream', self.suit)
     self.initIntervals()
     self.suit.nametag3d.stash()
     self.suit.nametag.destroy()
     return
 def __init__(self, index, collSolid, motionPath = None):
     self.prop = None
     self.suit = Suit.Suit()
     d = SuitDNA.SuitDNA()
     d.newSuit(Globals.Gameplay.MinionDnaName)
     self.suit.setDNA(d)
     self.suit.setScale(Globals.Gameplay.MinionScale)
     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')
     return
 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.nametag3d.stash()
     self.suit.nametag.destroy()
     return
 def __init__(self, nest, index, suitDnaName = 'le'):
     FSM.__init__(self, 'CogdoFlyingRobberBaron')
     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.isBaronInterested = 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, 'RobberBaron-%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.RobberBaron.InterestConeOffset, 0))
     self.attackTargetPos = None
     self.startOfRetreatToSkyPos = None
     pathModel = CogdoUtil.loadFlyingModel('RobberBaronPaths')
     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('RobberBaronScream', self.suit)
     self.initIntervals()
     self.suit.nametag3d.stash()
     self.suit.nametag.destroy()
     return
 def start(self):
     swapAvatarShadowPlacer(self.toon, self.toon.uniqueName('toonShadowPlacer'))
     self.toon.startSmooth()
Example #8
0
 def start(self):
     swapAvatarShadowPlacer(self.toon,
                            self.toon.uniqueName('toonShadowPlacer'))
     self.toon.startSmooth()