Example #1
0
    def __init__(self, trackGroup, ringModel, posScale, colorIndices):
        NodePath.__init__(self)
        self.assign(hidden.attachNewNode(\
            base.localAvatar.uniqueName('ring-group')))

        self.__period = trackGroup.period
        self.__reverseFlag = trackGroup.reverseFlag
        self.__tOffset = trackGroup.tOffset
        self.__numRings = len(trackGroup.tracks)

        self.__rings = []
        self.__ringModels = []
        for i in range(0,self.__numRings):
            track = trackGroup.tracks[i]
            tOffset = trackGroup.trackTOffsets[i]
            ring = Ring.Ring(track,
                             tOffset,
                             posScale)
            ring.reparentTo(self)

            model = ringModel.copyTo(ring)
            model.setColor(RingGameGlobals.ringColors[colorIndices[i]][1])

            self.__rings.append(ring)
            self.__ringModels.append(model)
Example #2
0
 def __init__(self,
              serialNum,
              model,
              triggerRadius,
              triggerOffset=(0, 0, 0),
              animate=True,
              animDuration=0.2,
              instanceModel=True,
              name='CogdoGameGatherable'):
     NodePath.__init__(self, '%s-%d' % (name, serialNum))
     self.serialNum = serialNum
     self._animate = animate
     if instanceModel:
         model.instanceTo(self)
         self._model = self
     else:
         self._model = model
         self._model.reparentTo(self)
         self._model.setPosHpr(0, 0, 0, 0, 0, 0)
     self._animDuration = animDuration
     self._animSeq = None
     self._initCollisions(triggerRadius, triggerOffset)
     self._update = None
     self._wasPickedUp = False
     return
Example #3
0
 def __init__(self, game, id, x, y):
     NodePath.__init__(self, 'dropNode%s' % id)
     self.game = game
     self.id = id
     self.reparentTo(hidden)
     self.setPos(x, y, 0)
     shadow = loader.loadModel('phase_3/models/props/square_drop_shadow')
     shadow.setZ(0.2)
     shadow.setBin('ground', 10)
     shadow.setColor(1, 1, 1, 1)
     shadow.reparentTo(self)
     self.shadow = shadow
     drop = CogdoUtil.loadMazeModel('cabinetSmFalling')
     roll = random.randint(-15, 15)
     drop.setHpr(0, 0, roll)
     drop.setZ(Globals.DropHeight)
     self.collTube = CollisionTube(0, 0, 0, 0, 0, 4, Globals.DropCollisionRadius)
     self.collTube.setTangible(0)
     name = Globals.DropCollisionName
     self.collNode = CollisionNode(name)
     self.collNode.addSolid(self.collTube)
     self.collNodePath = drop.attachNewNode(self.collNode)
     self.collNodePath.hide()
     self.collNodePath.setTag('isFalling', str('True'))
     drop.reparentTo(self)
     self.drop = drop
     self._dropSfx = base.cogdoGameAudioMgr.createSfxIval('drop', volume=0.6)
Example #4
0
    def __init__(self, moveTrack, tOffset, posScale=1.):
        NodePath.__init__(self)
        self.assign(hidden.attachNewNode(\
            base.localAvatar.uniqueName('ring')))

        self.setMoveTrack(moveTrack)
        self.setTOffset(tOffset)
        self.setPosScale(posScale)
        self.setT(0.)
Example #5
0
 def __init__(self, serialNum, model):
     NodePath.__init__(self, 'CogdoMazeWaterCooler-%i' % serialNum)
     self.serialNum = serialNum
     self._model = model
     self._model.reparentTo(self)
     self._model.setPosHpr(0, 0, 0, 0, 0, 0)
     self._initCollisions()
     self._initArrow()
     self._update = None
     self.__startUpdateTask()
     return
Example #6
0
 def __init__(self, parent, pos=None, scale =None):
     """Create a new indicator object."""
     NodePath.__init__(self, 'DinerStatusIndicator')
     if parent:
         self.reparentTo(parent)
     if pos:
         self.setPos(pos)
     if scale:
         self.setScale(scale)
     self.loadAssets()
     FSM.FSM.__init__(self,'DinerStatusIndicator')
     self.activeIval = None
Example #7
0
 def __init__(self, x, y, z, moleField, index):
     """Construct the mole hill."""
     NodePath.__init__(self, 'MoleHill-%d' % index)
     self.moleField= moleField
     self.index = index
     self.loadModel()
     self.setPos(x, y, z)
     self.schedule = []
     self.popIval = None
     self.downIval = None
     self.popupNum = 0 # how many times has this hill popped up
     self.hillType = None
     self.isUp = 0
Example #8
0
    def __init__(self, openSfx=None, closeSfx=None):
        NodePath.__init__(self, 'CogdoGameExit')
        self._model = CogdoUtil.loadModel('exitDoor')
        self._model.reparentTo(self)
        self._leftDoor = self._model.find('**/left_door')
        self._rightDoor = self._model.find('**/right_door')
        self._openSfx = openSfx or base.loadSfx(
            'phase_9/audio/sfx/CHQ_VP_door_open.mp3')
        self._closeSfx = closeSfx or base.loadSfx(
            'phase_9/audio/sfx/CHQ_VP_door_close.mp3')
        self._elevatorPoints = []
        for point in ElevatorConstants.ElevatorPoints:
            self._elevatorPoints.append(point[0])

        self._currentSlot = 0
        self._ival = None
        self._open = True
        self._toon2track = {}
        self.close(animate=False)
        return
Example #9
0
    def __init__(self, cr):
        DistributedNode.DistributedNode.__init__(self, cr)

        NodePath.__init__(self, "decor")
        ShadowCaster.ShadowCaster.__init__(self, False)

        self.plantPath = NodePath('plantPath')
        self.plantPath.reparentTo(self)
        #self.defaultModel = 'phase_9/models/cogHQ/square_stomper'
        self.defaultModel = 'phase_9/models/cogHQ/woodCrateB'
        self.messageName = None
        self.model = None
        self.colSphereNode = None
        self.rotateNode = None
        self.collSphereOffset = 0.0
        self.collSphereRadius = 1.0
        self.stickUp = 0.0
        self.movieNode = None
        self.shadowJoint = None
        self.shadowScale = 1
        self.expectingReplacement = 0
        self.movie = None
Example #10
0
 def initNodePath(self):
     # call this in the __init__ of any derived class that
     # doesn't already derive from NodePath
     node = hidden.attachNewNode('DistributedNodePathEntity')
     NodePath.__init__(self, node)