def __init__(self, moveTrack, tOffset, posScale = 1.0): NodePath.__init__(self) self.assign(hidden.attachNewNode(base.localAvatar.uniqueName('ring'))) self.setMoveTrack(moveTrack) self.setTOffset(tOffset) self.setPosScale(posScale) self.setT(0.0)
def __init__(self): NodePath.__init__(self, 'ExperimentTelevision') FSM.__init__(self, 'ExperimentTelevision') self.model = loader.loadModel('phase_4/models/events/blimp_tv.bam') self.model.reparentTo(self) self.staticTex = loader.loadTexture('phase_4/maps/blimp_tv_map_01.png') self.staticTex.setMinfilter(Texture.FTLinearMipmapLinear) self.staticTex.setMagfilter(Texture.FTLinear) self.chairmanTex = loader.loadTexture('phase_4/maps/blimp_tv_map_CM.png') self.chairmanTex.setMinfilter(Texture.FTLinearMipmapLinear) self.chairmanTex.setMagfilter(Texture.FTLinear) self.bossbotScene = BossbotScene() self.lawbotScene = LawbotScene() self.cashbotScene = CashbotScene() self.sellbotScene = SellbotScene() self.buffer = base.win.makeTextureBuffer('television', 960, 540) self.buffer.setSort(-1) self.camera = base.makeCamera(self.buffer) self.track = None
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)
def __initToBox__(self,name, size,mass = 0,add_visual = True): NodePath.__init__(self,BulletRigidBodyNode(name)) self.physics_world_ = None # size self.size_ = size # set collision shape collision_shape = BulletBoxShape(self.size_/2) collision_shape.setMargin(GameObject.DEFAULT_COLLISION_MARGIN) self.node().addShape(collision_shape) self.node().setMass(mass) self.setCollideMask(CollisionMasks.GAME_OBJECT_RIGID_BODY) # setting bounding volume min_point = LPoint3(-0.5*size.getX(),-0.5*size.getY(),-0.5*size.getZ()) max_point = LPoint3(0.5*size.getX(),0.5*size.getY(),0.5*size.getZ()) self.node().setBoundsType(BoundingVolume.BT_box) self.node().setBounds(BoundingBox(min_point ,max_point )) # Frame of reference self.reference_np_ = None # visual properties if add_visual: visual_np = GameObject.createSimpleBoxVisualNode(self,self.size_, self.getName() + '-visual') # setting ID GameObject.setObjectID(self, self.getName())
def __init__(self, x, y, z, direction, id): NodePath.__init__(self,loader.loadModel("../Models/missile")) self.reparentTo(render) self.setPos(x, y, z) self.direction = Vec3() self.direction.set(direction.getX(), direction.getY(), direction.getZ()) self.setH(Vec2.signedAngleDeg(Vec2(0,1), Vec2(direction.getX(),direction.getY()))) if self.direction.length() == 0: self.removeNode() return self.direction /= direction.length() min, max = self.getTightBounds() size = max - min maximum = -1 for i in size: if i > maximum: maximum = i self.cnode = CollisionNode('bullet') self.cnode.setTag( "id", str(id) ) self.cnode.addSolid(CollisionSphere(0, 0, 0, maximum + 0.3)) self.cnodePath = self.attachNewNode(self.cnode) self.cnodePath.show() base.cTrav.addCollider(self.cnodePath, base.event) taskMgr.add(self.updateBullet, "update Bullet") print radiansToDegrees(atan2(direction.getY(),direction.getX()))
def __init__(self,*args): """ Creates an empty game object GameObject(string name) GameObject(BulletBodyNode bn) Inherits from panda3d.core.NodePath """ name = '' bn = None if len(args) > 0: if isinstance(args[0],str): name = args[0] NodePath.__init__(self,PandaNode(name)) elif isinstance(args[0], BulletBodyNode): bn = args[0] NodePath.__init__(self,bn) else: raise ValueError('Invalid argument for GameObject') # instantiating to a bullet rigid body self.physics_world_ = None self.size_ = self.__estimateSize__() GameObject.setObjectID(self, self.getName())
def __init__(self, parent=None): NodePath.__init__(self, self.__class__.__name__) if not parent: self.reparentTo(aspect2d) # @UndefinedVariable else: self.reparentTo(parent) self._itemlist = []
def __init__(self,name,parent_np , physics_world, tr = TransformState.makeIdentity()): """ Sector(NodePath parent_np, TransformState tr = TransformState.makeIdentity() Creates a level Sector object which ensures that all objects in it only move in the x and z directions relative to the sector. The z and x vectors lie on the plane with +X pointing to the right and +Z pointing up. +Y is perpedicular to the plane into the screen from the user's perspective @param parent_np: NodePath to the parent of the sector, usually is the Level object that contains the sector. @param physics_world: The physics world @param tf: Transform of the sector relative to the parent_np NodePath """ NodePath.__init__(self,name) self.reparentTo(parent_np) self.setTransform(self,tr) self.physics_world_ = physics_world # creating 2d motion plane self.motion_plane_np_ = self.attachNewNode(BulletRigidBodyNode(self.getName() + '-motion-plane')) self.motion_plane_np_.node().setMass(0) self.motion_plane_np_.node().setIntoCollideMask(CollisionMasks.NO_COLLISION) self.motion_plane_np_.node().addShape(BulletPlaneShape(Vec3(0,1,0),0)) self.physics_world_.attach(self.motion_plane_np_.node()) self.motion_plane_np_.reparentTo(parent_np) self.motion_plane_np_.setTransform(self,TransformState.makeIdentity()) # game objects self.object_constraints_dict_ = {} # stores tuples of the form (String,BulletConstraint) # sector transitions self.sector_transitions_ = [] self.destination_sector_dict_ = {}
def __init__(self, scale=1, value=0, r=10, g=0, b=0): NodePath.__init__(self, 'healthbar') self.value = value self.scale = scale self.range = 1.0 self.buff = 0 cmbg = CardMaker('bg') cmbg.setFrame(- scale, scale, -0.1 * scale, 0.1 * scale) self.bg = self.attachNewNode(cmbg.generate()) self.bg.setColor(0.2, 0.2, 0.2, 1) self.bg.setPos(0,0,5.8) cmfg = CardMaker('fg') cmfg.setFrame(- scale, scale, -0.1 * scale, 0.1 * scale) self.fg = self.bg.attachNewNode(cmfg.generate()) self.fg.setColor(r, g, b, 1) self.fg.setPos(0,-0.1,0) self.fg.setBillboardPointWorld() self.bg.setBillboardPointWorld() self.fg.clearShader() self.bg.clearShader() self.setValue(0)
def __init__(self,L0,R0,numSegs,bark,nodeName): NodePath.__init__(self,nodeName) self.L0 = L0 self.R0 = R0 self.numSegs = numSegs self.trunk = Branch("Trunk",L0,R0,2*numSegs) self.trunk.reparentTo(self) self.trunk.setTexture(bark)
def __init__(self,name): NodePath.__init__(self,name) self.setTransparency(TransparencyAttrib.M_alpha) self.seq_left_ = None self.seq_right_ = None self.facing_right_ = True self.name_ = name self.size_ = (0,0)
def __init__(self, gameWorld): NodePath.__init__(self, "jbsBarrel") FSM.FSM.__init__(self, "jbsBarrelFSM") self.gameWorld = gameWorld self.barrelMdl = None self.collisionName = "fsJBSBarrel" + str(id(self)) self.collisionNode = None self.soundCollected = None return
def __init__(self,name,physics_world): NodePath.__init__(self,name) self.object_nodes_ = [] self.physics_world_ = physics_world self.detection_plane_ = None self.constraint_plane_ = None self.box_contraints_ = [] self.character_constraint_ = None
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'shop') self.cr = cr self.items = {} self.destroyEvent = 'destroyShop-' + str(random.randint(0, 1000)) self.inShop = False self.clerk = None self.shopNP = None return
def __init__(self,name,size,src_sector_name,destination_sector_name, entrance_pos = None): NodePath.__init__(self,BulletGhostNode(name)) self.src_sector_name_ = src_sector_name self.destination_sector_name_ = destination_sector_name self.node().addShape(BulletBoxShape(size/2)) self.node().getShape(0).setMargin(0.01) self.node().setIntoCollideMask(CollisionMasks.SECTOR_TRANSITION) self.setPythonTag(SectorTransition.DESTINATION_SECTOR_NAME, self.destination_sector_name_) self.setPythonTag(SectorTransition.ENTRANCE_POSITION,entrance_pos)
def __init__(self, mg, index): self.mg = mg self.index = index self.model = None self.collNP = None self.isAirborne = False self.owner = None self.throwIval = None self.impactSound = base.loadSfx('phase_4/audio/sfx/snowball_hit.ogg') NodePath.__init__(self, 'snowball') return
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
def __init__(self, size = (0.0,0.0), align = ALIGN.CENTER, centerOffset = (0,0) , name = None): self._width = size[0] self._height = size[1] self._align = align self._centerOffset = centerOffset self.__cleanup = False name = name or self.__class__.__name__ NodePath.__init__(self, name) DirectObject.__init__(self)
def __init__(self, air, name=None): # Be careful not to create multiple NodePath objects try: self.DistributedNodeAI_initialized except: self.DistributedNodeAI_initialized = 1 DistributedObjectAI.DistributedObjectAI.__init__(self, air) if name is None: name = self.__class__.__name__ NodePath.__init__(self, name) self.gridParent = None
def __init__(self, cr): NodePath.__init__(self, 'DistributedGameTable') DistributedInteractive.DistributedInteractive.__init__(self, cr) self.localAvatarSeat = -1 self.maxHandCards = 2 self.requestDialog = None self.seatLodNodeArray = [] self.avId2ivals = {} self.possibleUndeadTypes = [] self.possibleUndeadNames = [] return
def __init__(self): NodePath.__init__(self, 'pbar') self.bar = DirectWaitBar(range = 150, frameColor = (1, 1, 1, 1), barColor = (0.286, 0.901, 1, 1), relief = DGG.RAISED, borderWidth = (0.04, 0.04), pos = (0, 0, 0.85), scale = 0.2, hpr = (0, 0, 0), parent = self, frameSize = (-0.85, 0.85, -0.12, 0.12)) self.hide() self.reparentTo(aspect2d) self.speed = 0.2 self.exponent = 0.75 self.startTime = 0.0 self.task = None
def __init__(self, cr): try: self.DistributedNode_initialized except: self.DistributedNode_initialized = 1 self.gotStringParentToken = 0 DistributedObject.DistributedObject.__init__(self, cr) if not self.this: NodePath.__init__(self, "DistributedNode") # initialize gridParent self.gridParent = None
def __init__(self, parent, pos = None, scale = None): 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 return
def __init__(self, achievementId): NodePath.__init__(self, hidden.attachNewNode('achievement-popup-%s' % id(self))) AchievementNode(achievementId).reparentTo(self) self.reparentTo(base.a2dTopCenter, 4000) self.stash() self.setScale(0.3) self.setZ(-0.18) self.callback = None
def __init__(self, x, y, z): NodePath.__init__(self, 'MoleHill') self.loadModel() self.reparentTo(render) self.setPos(x, y, z) self.schedule = [] self.popIval = None self.downIval = None self.popupNum = 0 self.hillType = None self.isUp = 0 return
def __init__(self, parent, pos=None, scale=None): 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 return
def __init__(self,parent = None, height = 0): self.parent = parent or aspect2d NodePath.__init__(self,'line') self.reparentTo(self.parent) self.currentPtr = (0,0,0) self.lineHeight = height self.lineWidth = 0 self.items = [] #each word/character is a NodePath self.__lerpIntervals = [] self.__lock = Lock()
def __init__(self, x, y, z, moleField, index): 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 self.hillType = None self.isUp = 0 return
def __init__(self, achievementId): NodePath.__init__( self, hidden.attachNewNode('achievement-popup-%s' % id(self))) AchievementNode(achievementId).reparentTo(self) self.reparentTo(base.a2dTopCenter, 4000) self.stash() self.setScale(0.3) self.setZ(-0.18) self.callback = None
def __init__(self, cr): try: self.DistributedShop_initialized return except: self.DistributedShop_initialized = 1 DistributedNode.__init__(self, cr) NodePath.__init__(self, "shop") self.inShop = False self.snp = None self.clerk = None return
def __init__(self, name, radius, collideEvent=None, mask=CIGlobals.WorldGroup, offset=Point3(0), needSelfInArgs=False, startNow=True, myMask=CIGlobals.EventGroup, exclusions=[], resultInArgs=False, useSweep=False, world=None, initNp=True, useGhost=True): if self.WantNPInit: NodePath.__init__(self) if useGhost: node = BulletGhostNode(name) else: node = BulletRigidBodyNode(name) self.assign(NodePath(node)) self.needSelfInArgs = needSelfInArgs self.resultInArgs = resultInArgs self.event = collideEvent self.mask = mask self.__exclusions = [] self.useSweep = useSweep if not world and hasattr(base, 'physicsWorld') and not self.IsAI: world = base.physicsWorld self.world = world self.initialPos = Point3(0) self.lastPos = Point3(0) self.lastPosTime = 0.0 self.hitCallbacks = [] sphere = BulletSphereShape(radius) self.node().addShape(sphere, TransformState.makePos(offset)) self.node().setKinematic(True) if useSweep: self.node().setCcdMotionThreshold(1e-7) self.node().setCcdSweptSphereRadius(radius * 1.05) self.setCollideMask(myMask) if startNow: self.start()
def __init__(self): try: self.__initialized return except: self.__initialized = 1 NodePath.__init__(self, hidden.attachNewNode('PositionExaminer')) bsph = BulletSphereShape(1.5) bgh = BulletGhostNode('positionExaminer_sphereGhost') bgh.addShape(bsph) bgh.setKinematic(True) self.cSphereNodePath = self.attachNewNode(bgh)
def __init__(self): NodePath.__init__(self, 'wave-report-gui') self.setBin('fixed', 60) self.setTransparency(True, 1) self.setAlphaScale(0.75) self.reparentTo(aspect2d) self.popupSound = base.loadSfx("phase_3/audio/sfx/GUI_balloon_popup.ogg") self.widgets = [] self.frame = DirectFrame(image = 'materials/ui/wave_report_base.png', image_scale = (.395 * 1.3, 1, .311 * 1.3), relief = None, parent = self) self.completeText = OnscreenText(text = "Wave 1 Complete", parent = self.frame, pos = (0, 0.29, 0)) self.hide()
def __init__(self, characterName, characterPath, markerPath, nodeParent, world, arInstance): NodePath.__init__(self, characterName) self.character = Character(characterName, characterPath, markerPath, self, arInstance) self.overlays = {'vision': (None, False), 'movement': (None, False)} self.reparentTo(nodeParent) arInstance.attachPattern(markerPath, self) self.world = world self.location = (0,0) possibleMoves = self.getPossibleMoves() print len(possibleMoves) for tile in possibleMoves: print tile.coords
def __init__(self, text, speaker = None, voiceName = None, parent = None, height = 0): #TODO add a voice button in it NodePath.__init__(self,'texthistorylabel') self.parent = parent or aspect2d self.reparentTo(parent) if speaker: text = '\1th_name\1(' + speaker.strip() + ')\n\2' + text self.textcontent = OnscreenText(text = text,align = TextNode.ALeft, pos = (TEXTLEFT,-height), wordwrap = WORDWRAP, parent = self, **base.getStyle('historytext')) self.labelHeight = self.textcontent.textNode.getHeight() * self.textcontent.getScale()[1]
def __init__(self, nodeName, L, initRadius, nSeg): NodePath.__init__(self, nodeName) self.numPrimitives = 0 self.nodeList = [] # for the branch geometry itself self.buds = [] # a list of children. "buds" for next gen of branchs self.length = L # total length of this branch; note Node scaling will mess this up! self.R0 = initRadius self.nSeg = nSeg self.gen = 0 # ID's generation of this branch (trunk = 0, 1 = primary branches, ...) # contains 2 Vec3:[ position, and Hpr]. Nominally these are set by the parent Tree class # with it's add children function(s) self.bodydata = GeomVertexData("body vertices", GeomVertexFormat.getV3n3t2(), Geom.UHStatic) self.bodies = NodePath("Bodies") self.bodies.reparentTo(self)
def __init__(self, parent=hidden, wantSound=0): NodePath.__init__(self) model = loader.loadModel('phase_3.5/models/props/dust_cloud') self.assign(model) model.removeNode() self.reparentTo(parent) self.seqNode = self.find('**/+SequenceNode').node() self.seqNode.setFrameRate(0) self.wantSound = wantSound self.poofSound = loader.loadSfx('phase_audio/sfx/poof.ogg') self.track = None self.trackId = DustCloud.dustCloudCount DustCloud.dustCloudCount += 1 self.setBin('gui-popup', 100, 1) self.hide()
def __init__(self, name=None, navigation_url=None, browser_settings=None): if name is None: name = self.__class__.__name__ NodePath.__init__(self, name) self._chrome_texture = ChromiumTexture( '%s-ChromiumBrowserTexture' % name, navigation_url=navigation_url, browser_settings=browser_settings) card_maker = CardMaker('chromebrowser2d') card_maker.set_frame(-0.75, 0.75, -0.75, 0.75) self._card = self.attach_new_node(card_maker.generate()) self._card.set_texture(self._chrome_texture)
def __init__(self, parent, model, name=""): NodePath.__init__(self, name) self.name = name if not self.ANIMATIONS: # Load static model self.model = loader.loadModel("models/%s.bam" % (model,)) else: # Load animated model animations = dict((name, "models/%s-%s.bam" % (model, name)) for name in self.ANIMATIONS) self.model = Actor("models/%s.bam" % (model,), animations) self.model.reparentTo(self) self.reparentTo(parent)
def __init__(self,camera_np, name = "CameraController"): NodePath.__init__(self,name) self.target_np_ = None self.camera_np_ = camera_np self.target_tracker_np_ = self.attachNewNode("TargetTrackerNode") self.enabled_ = True self.smoothing_ = False self.target_ref_np_ = None # position tracking self.target_locked_ = True # rotation tracking self.rot_pr_target_ = Vec3.zero() self.rot_interpolation_sequence_ = Sequence()
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'capture_point') self.capturePoint = None self.captureCircle = None self.aoogahSfx = None self.circleTrack = None self.circleTrackPlayRate = 1.0 self.circleTrackDirection = 0 self.team = None self.collNP = None self.pointCollNode = None self.neutralCapTexture = None self.redCapTexture = None self.blueCapTexture = None self.defCapTexture = None return
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
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 xrange(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)
def __init__(self, parent, nodeName, clickEvent): NodePath.__init__(self, parent.attachNewNode(nodeName)) self.clickEvent = clickEvent self.normalNode = CatalogGlobals.CatalogNodePath.find( '**/arrow_UP_' + nodeName).copyTo(self) self.clickedNode = CatalogGlobals.CatalogNodePath.find( '**/arrow_DN_' + nodeName).copyTo(self) self.hoverNode = CatalogGlobals.CatalogNodePath.find( '**/arrow_OVR_' + nodeName).copyTo(self) self.arrowButton = DirectButton(parent=self, relief=None, image=(self.normalNode, self.clickedNode, self.hoverNode), command=self.clickEvent)
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'restock_barrel') self.grabSfx = None self.rejectSfx = None self.grabSoundPath = 'phase_4/audio/sfx/SZ_DD_treasure.ogg' self.rejectSoundPath = 'phase_4/audio/sfx/ring_miss.ogg' self.animTrack = None self.barrelScale = 0.5 self.sphereRadius = 3.2 self.playSoundForRemoteToons = 1 self.barrel = None self.gagNode = None self.gagModel = None self.collSphere = None self.collNode = None self.collNodePath = None return
def __init__(self, index=0): NodePath.__init__(self, 'TrafficLight-' + str(id(self))) self.light = loader.loadModel('phase_14/models/props/cogtropolis_streetlight.egg') for partName, colorName in self.part2Color.items(): for node in self.light.findAllMatches('**/' + partName): if '_coll' not in node.getName(): node.setColor(self.colors[colorName]) self.light.reparentTo(self) if index == 1: self.setH(-90) self.find('**/pole1').stash() self.find('**/pole1_coll').stash() self.setTwoSided(1) self.soundFlicker = base.audio3d.loadSfx('phase_14/audio/sfx/cogtropolis_trafficlight_flicker.ogg') base.audio3d.attachSoundToObject(self.soundFlicker, self.find('**/light-base')) self.flashTrack = None return
def __init__(self): NodePath.__init__(self, 'waterBar') self.range = 100 self.value = 100 self.back = OnscreenImage("phase_14/maps/backv2.png", scale = (0.289, 1, 0.813), parent = self) self.bar = OnscreenImage("phase_14/maps/frontv2.png", scale = (0.233, 1, 0.740), parent = self) self.setTransparency(1) barSh = loader.loadShader("shaders/progress_bar.sha") self.bar.setShader(barSh) self.bar.setShaderInput("tex", loader.loadTexture("phase_14/maps/frontv2.png")) self.bar.setShaderInput("perct", float(self.value) / float(self.range)) self.bar.setShaderInput("dir", 0) self.bar.setShaderInput("alpha", 1.0) self.task = taskMgr.add(self.__update, "WaterBar.update")
def __init__(self): try: self.__initialized return except: self.__initialized = 1 NodePath.__init__(self, hidden.attachNewNode('PositionExaminer')) self.cRay = CollisionRay(0.0, 0.0, 6.0, 0.0, 0.0, -1.0) self.cRayNode = CollisionNode('cRayNode') self.cRayNode.addSolid(self.cRay) self.cRayNodePath = self.attachNewNode(self.cRayNode) self.cRayNodePath.hide() self.cRayBitMask = CIGlobals.FloorBitmask self.cRayNode.setFromCollideMask(self.cRayBitMask) self.cRayNode.setIntoCollideMask(BitMask32.allOff()) self.cSphere = CollisionSphere(0.0, 0.0, 0.0, 1.5) self.cSphereNode = CollisionNode('cSphereNode') self.cSphereNode.addSolid(self.cSphere) self.cSphereNodePath = self.attachNewNode(self.cSphereNode) self.cSphereNodePath.hide() self.cSphereBitMask = CIGlobals.WallBitmask self.cSphereNode.setFromCollideMask(self.cSphereBitMask) self.cSphereNode.setIntoCollideMask(BitMask32.allOff()) self.ccLine = CollisionSegment(0.0, 0.0, 0.0, 1.0, 0.0, 0.0) self.ccLineNode = CollisionNode('ccLineNode') self.ccLineNode.addSolid(self.ccLine) self.ccLineNodePath = self.attachNewNode(self.ccLineNode) self.ccLineNodePath.hide() self.ccLineBitMask = CIGlobals.CameraBitmask self.ccLineNode.setFromCollideMask(self.ccLineBitMask) self.ccLineNode.setIntoCollideMask(BitMask32.allOff()) self.cRayTrav = CollisionTraverser('PositionExaminer.cRayTrav') self.cRayTrav.setRespectPrevTransform(False) self.cRayQueue = CollisionHandlerQueue() self.cRayTrav.addCollider(self.cRayNodePath, self.cRayQueue) self.cSphereTrav = CollisionTraverser('PositionExaminer.cSphereTrav') self.cSphereTrav.setRespectPrevTransform(False) self.cSphereQueue = CollisionHandlerQueue() self.cSphereTrav.addCollider(self.cSphereNodePath, self.cSphereQueue) self.ccLineTrav = CollisionTraverser('PositionExaminer.ccLineTrav') self.ccLineTrav.setRespectPrevTransform(False) self.ccLineQueue = CollisionHandlerQueue() self.ccLineTrav.addCollider(self.ccLineNodePath, self.ccLineQueue)
def __init__(self, damagePos): NodePath.__init__(self, 'dir-damage-indicator') self.reparentTo(aspect2d) self.damagePos = damagePos self.task = taskMgr.add(self.__update, 'ddi-update') self.img = OnscreenImage(image='materials/ui/damage_indicator.png', parent=self) self.setTransparency(True) self.setColorScale((1, 1, 1, 0.5)) self.setScale(0.25) self.time = globalClock.getFrameTime() self.track = Sequence( Wait(1.5), LerpColorScaleInterval(self, 0.5, (1, 1, 1, 0), (1, 1, 1, 0.5)), Func(self.removeNode)) self.track.start() DDIByPos[self.damagePos] = self
def __init__(self, loc = (0, 0, 0), parent = None): NodePath.__init__(self, 'explosion') if parent is None: parent = render self.reparentTo(parent) self.setPos(loc) self.poof = ParticleLoader.loadParticleEffect('resources/phase_14/etc/explosion_poof.ptf') self.poof.start(self) self.lines = ParticleLoader.loadParticleEffect('resources/phase_14/etc/explosion_sparks.ptf') self.lines.start(self) self.smoke = ParticleLoader.loadParticleEffect('resources/phase_14/etc/explosion_smoke.ptf') self.smoke.start(self) taskMgr.doMethodLater(4.0, self.__cleanupTask, "Explosion_cleanupTask")
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/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 return