Ejemplo n.º 1
0
 def __init__(self,
              world,
              space,
              controller,
              local=net.netMode == net.MODE_SERVER):
     Actor.__init__(self, world, space, "models/basicdroid/BasicDroid",
                    controller, local)
     self.radius = 1
     self.collisionNode = CollisionNode("cnode")
     self.collisionNodePath = self.node.attachNewNode(self.collisionNode)
     self.collisionNode.addSolid(
         CollisionSphere(0, 0, 0, self.radius + 0.05))
     self.node.hide(BitMask32.bit(4))  # Don't cast shadows
     self.node.setTransparency(
         TransparencyAttrib.MAlpha)  # For when we're cloaked
     self.lowResNode = engine.loadModel(
         "models/basicdroid/BasicDroid-lowres")
     self.lowResNode.reparentTo(self.node)
     self.lowResNode.hide(BitMask32.bit(1))
     self.lowResNode.showThrough(BitMask32.bit(4))  # Low-res shadow caster
     self.body = OdeBody(world)
     M = OdeMass()
     M.setSphere(15, self.radius)
     self.body.setMass(M)
     self.geometry = OdeSphereGeom(space, self.radius)
     self.geometry.setCollideBits(BitMask32(0x00000001))
     self.geometry.setCategoryBits(BitMask32(0x00000001))
     self.geometry.setBody(self.body)
     space.setSurfaceType(self.geometry, 2)
     self.cloaked = False
     self.shielded = False
     self.crosshairNode = engine.loadModel("models/crosshair/crosshair")
     self.crosshairNode.setBillboardPointEye()
     self.crosshairNode.reparentTo(self.node)
     self.crosshairNode.setShaderOff()
     self.crosshairNode.setLightOff(True)
     self.crosshairNode.hide()
     self.crosshairNode.setScale(1.5)
     self.shieldNode = engine.loadModel("models/shield/shield")
     self.shieldNode.reparentTo(self.node)
     self.shieldNode.setTwoSided(True)
     self.shieldNode.setColor(1.0, 0.9, 0.8, 0.6)
     self.shieldNode.setShaderOff(True)
     self.shieldNode.setTransparency(TransparencyAttrib.MAlpha)
     self.shieldNode.hide()
     self.shieldNode.hide(BitMask32.bit(4))  # Don't cast shadows
     self.initialSpawnShieldEnabled = True
     self.weaponIds = []
     self.specialId = None
     self.special = None
Ejemplo n.º 2
0
	def __init__(self, pos, direction):
		GraphicsObject.__init__(self)
		self.node = engine.loadModel("models/spike/spike")
		self.node.reparentTo(engine.renderLit)
		self.node.setPos(pos)
		self.node.lookAt(Point3(pos + direction))
		self.spawnTime = engine.clock.time
		self.entity = None
		self.lifetime = 5.0
Ejemplo n.º 3
0
 def __init__(self, pos, direction):
     GraphicsObject.__init__(self)
     self.node = engine.loadModel("models/spike/spike")
     self.node.reparentTo(engine.renderLit)
     self.node.setPos(pos)
     self.node.lookAt(Point3(pos + direction))
     self.spawnTime = engine.clock.time
     self.entity = None
     self.lifetime = 5.0
Ejemplo n.º 4
0
	def __init__(self, world, space, controller, local = net.netMode == net.MODE_SERVER):
		Actor.__init__(self, world, space, "models/basicdroid/BasicDroid", controller, local)
		self.radius = 1
		self.collisionNode = CollisionNode("cnode")
		self.collisionNodePath = self.node.attachNewNode(self.collisionNode)
		self.collisionNode.addSolid(CollisionSphere(0, 0, 0, self.radius + 0.05))
		self.node.hide(BitMask32.bit(4)) # Don't cast shadows
		self.node.setTransparency(TransparencyAttrib.MAlpha) # For when we're cloaked
		self.lowResNode = engine.loadModel("models/basicdroid/BasicDroid-lowres")
		self.lowResNode.reparentTo(self.node)
		self.lowResNode.hide(BitMask32.bit(1))
		self.lowResNode.showThrough(BitMask32.bit(4)) # Low-res shadow caster
		self.body = OdeBody(world)
		M = OdeMass()
		M.setSphere(15, self.radius)
		self.body.setMass(M)
		self.geometry = OdeSphereGeom(space, self.radius)
		self.geometry.setCollideBits(BitMask32(0x00000001))
		self.geometry.setCategoryBits(BitMask32(0x00000001))
		self.geometry.setBody(self.body)
		space.setSurfaceType(self.geometry, 2)
		self.cloaked = False
		self.shielded = False
		self.crosshairNode = engine.loadModel("models/crosshair/crosshair")
		self.crosshairNode.setBillboardPointEye()
		self.crosshairNode.reparentTo(self.node)
		self.crosshairNode.setShaderOff()
		self.crosshairNode.setLightOff(True)
		self.crosshairNode.hide()
		self.crosshairNode.setScale(1.5)
		self.shieldNode = engine.loadModel("models/shield/shield")
		self.shieldNode.reparentTo(self.node)
		self.shieldNode.setTwoSided(True)
		self.shieldNode.setColor(1.0, 0.9, 0.8, 0.6)
		self.shieldNode.setShaderOff(True)
		self.shieldNode.setTransparency(TransparencyAttrib.MAlpha)
		self.shieldNode.hide()
		self.shieldNode.hide(BitMask32.bit(4)) # Don't cast shadows
		self.initialSpawnShieldEnabled = True
		self.weaponIds = []
		self.specialId = None
		self.special = None
Ejemplo n.º 5
0
Archivo: ai.py Proyecto: etodd/a3p
	def __init__(self, directory, filename):
		global navMeshCache
		self.edges = []
		self.nodes = []
		self.filename = filename
		if directory + "/" + self.filename in navMeshCache:
			navMesh = navMeshCache[directory + "/" + self.filename]
			self.edges = navMesh.edges
			self.nodes = navMesh.nodes
		else:
			node = engine.loadModel(directory + "/" + self.filename)
			self._processNode(node)
			node.removeNode()
			navMeshCache[directory + "/" + self.filename] = self
Ejemplo n.º 6
0
 def __init__(self, directory, filename):
     global navMeshCache
     self.edges = []
     self.nodes = []
     self.filename = filename
     if directory + "/" + self.filename in navMeshCache:
         navMesh = navMeshCache[directory + "/" + self.filename]
         self.edges = navMesh.edges
         self.nodes = navMesh.nodes
     else:
         node = engine.loadModel(directory + "/" + self.filename)
         self._processNode(node)
         node.removeNode()
         navMeshCache[directory + "/" + self.filename] = self
Ejemplo n.º 7
0
 def __init__(self, actor, damage, modelFile, id):
     Weapon.__init__(self, actor, id)
     self.clipSize = 10
     self.ammo = self.clipSize
     self.ammoAdditions = 0 # So that if fire() is called between serverUpdate and clientUpdate, ammo is still depleted
     self.reloadTime = 2.0
     self.newReloadActive = False
     self.reloadStarted = False # Server side; only true one frame
     self.damage = damage
     self.lastReload = -1
     self.ricochetSound = audio.SoundPlayer("ricochet")
     self.reloadSound = audio.SoundPlayer("reload")
     self.showSound = audio.SoundPlayer("change-weapon")
     self.node = engine.loadModel(modelFile)
     self.modelFile = modelFile
     self.node.reparentTo(engine.renderLit)
     self.activeSound = 0 # Client side
     self.showTime = -1 # For the showing animation
     self.totalShowTime = 0.3
     Gun.hide(self)
Ejemplo n.º 8
0
 def __init__(self, actor, damage, modelFile, id):
     Weapon.__init__(self, actor, id)
     self.clipSize = 10
     self.ammo = self.clipSize
     self.ammoAdditions = 0  # So that if fire() is called between serverUpdate and clientUpdate, ammo is still depleted
     self.reloadTime = 2.0
     self.newReloadActive = False
     self.reloadStarted = False  # Server side; only true one frame
     self.damage = damage
     self.lastReload = -1
     self.ricochetSound = audio.SoundPlayer("ricochet")
     self.reloadSound = audio.SoundPlayer("reload")
     self.showSound = audio.SoundPlayer("change-weapon")
     self.node = engine.loadModel(modelFile)
     self.modelFile = modelFile
     self.node.reparentTo(engine.renderLit)
     self.activeSound = 0  # Client side
     self.showTime = -1  # For the showing animation
     self.totalShowTime = 0.3
     Gun.hide(self)
Ejemplo n.º 9
0
 def loadModel(self, filename):
     self.filename = filename
     self.node = engine.loadModel(filename)
     self.node.setName(str(int(self.id)))
     self.radius = self.node.getBounds().getRadius()
Ejemplo n.º 10
0
	def loadModel(self, filename):
		self.filename = filename
		self.node = engine.loadModel(filename)
		self.node.setName(str(int(self.id)))
		self.radius = self.node.getBounds().getRadius()
Ejemplo n.º 11
0
 def __init__(self, world, worldNP, controller, local = net.netMode == net.MODE_SERVER):
     Actor.__init__(self, world, worldNP, "models/basicdroid/BasicDroid", controller, local)
     self.radius = 1
     self.collisionNode = CollisionNode("cnode")
     self.collisionNodePath = self.node.attachNewNode(self.collisionNode)
     self.collisionNode.addSolid(CollisionSphere(0, 0, 0, self.radius + 0.05))
     self.node.hide(BitMask32.bit(4)) # Don't cast shadows
     self.node.setTransparency(TransparencyAttrib.MDual) # For when we're cloaked
     self.lowResNode = engine.loadModel("models/basicdroid/BasicDroid-lowres")
     self.lowResNode.reparentTo(self.node)
     self.lowResNode.hide(BitMask32.bit(1))
     self.lowResNode.showThrough(BitMask32.bit(4)) # Low-res shadow caster
     
     self.geometry = BulletSphereShape(self.radius)
     self.body = worldNP.attachNewNode(BulletRigidBodyNode('BasicDroid'))
     self.body.node().setMass(15.0)
     self.body.node().setFriction(10.0)
     self.body.node().setAngularDamping(0.6)
     self.body.node().addShape(self.geometry)        
     self.body.node().setDeactivationEnabled(False)
     # Enable CCD
     #self.body.node().setCcdMotionThreshold(1e-7)
     #self.body.node().setCcdSweptSphereRadius(self.radius*0.8)        
     world.attachRigidBody(self.body.node())
     
     #ghost part
     #ghost_shape = BulletSphereShape(self.radius)
     #self.ghost = self.sphere_np.attachNewNode(BulletGhostNode('Ghost'))
     #self.ghost.node().addShape(ghost_shape)
     #self.world.attachGhost(self.ghost.node()) 
     
     
     #self.body = OdeBody(world)
     #M = OdeMass()
     #M.setSphere(15, self.radius)
     #self.body.setMass(M)
     #self.geometry = OdeSphereGeom(space, self.radius)
     #self.geometry.setCollideBits(BitMask32(0x00000001))
     #self.geometry.setCategoryBits(BitMask32(0x00000001))
     #self.geometry.setBody(self.body)
     #space.setSurfaceType(self.geometry, 2)
     
     self.cloaked = False
     self.shielded = False
     self.crosshairNode = engine.loadModel("models/crosshair/crosshair")
     self.crosshairNode.setBillboardPointEye()
     self.crosshairNode.reparentTo(self.node)
     self.crosshairNode.setShaderOff()
     self.crosshairNode.setLightOff(True)
     self.crosshairNode.hide()
     self.crosshairNode.setScale(1.5)
     self.shieldNode = engine.loadModel("models/shield/shield")
     self.shieldNode.reparentTo(self.node)
     self.shieldNode.setTwoSided(True)
     self.shieldNode.setColor(1.0, 0.9, 0.8, 0.6)
     self.shieldNode.setShaderOff(True)
     self.shieldNode.setTransparency(TransparencyAttrib.MDual)
     self.shieldNode.hide()
     self.shieldNode.hide(BitMask32.bit(4)) # Don't cast shadows
     self.initialSpawnShieldEnabled = True
     self.weaponIds = []
     self.specialId = None
     self.special = None