def setupHpMeter(self):
     if self.hpMeter:
         return
     zAdj = 50
     self.smokeZAdj = zAdj
     self.fortPart = self.fortNode.find('**/top_interior_wall_collision')
     if self.fortPart.isEmpty():
         self.fortPart = self.fortNode.find('**/col_TopFloor1')
     if self.fortPart.isEmpty():
         self.fortPart = self.fortNode.find('**/pPlane4')
         zAdj = 150
         self.smokeZAdj = 100
     if self.fortPart.isEmpty():
         self.fortPart = self.fortNode.find('**/*tower*')
     if self.fortPart.isEmpty():
         self.fortPart = self.fortNode.find('**/*buttress*')
     if self.fortPart.isEmpty():
         self.fortPart = self.fortNode.find('**/*floor*')
     fortPartBounds = self.fortPart.getBounds()
     self.hpAnchor = NodePath('hpAnchor')
     self.hpAnchor.setPos(fortPartBounds.getApproxCenter())
     self.hpAnchor.setZ(self.hpAnchor.getZ() + zAdj)
     self.hpAnchor.reparentTo(self.fortNode)
     self.hpMeter = HpMeter.HpMeter(fadeOut=0,
                                    parent=self.hpAnchor,
                                    originAtMidPt=True)
     self.hpMeter.setScale(200)
     self.hpMeter.setBin('fixed', 130)
     self.hpMeter.setDepthWrite(False)
     myEffect = BillboardEffect.make(Vec3(0, 0, 1), True, False, 150,
                                     NodePath(), Point3(0, 0, 0))
     self.hpMeter.node().setEffect(myEffect)
     self.hpMeter.update(self.hp, self.maxHp)
     self.hideFortHpMeter()
Exemplo n.º 2
0
 def CreateRing( self, vector, colour, lookAt ):
     
     # Create the billboard effect
     bbe = BillboardEffect.make( vector, False, True, 0, lookAt, (0, 0, 0) )
     
     # Create an arc
     arc = Arc( numSegs=32, degrees=180, axis=Vec3(0, 0, 1) )
     arc.setH( 180 )
     arc.setEffect( bbe )
     
     # Create the axis from the arc
     axis = Axis( self.name, vector, colour )
     axis.AddGeometry( arc, sizeStyle=SCALE )
     axis.AddCollisionSolid( self.collSphere, sizeStyle=SCALE )
     axis.reparentTo( self )
     
     return axis
Exemplo n.º 3
0
 def CreateRing( self, vector, colour, lookAt ):
     # Create the billboard effect
     bbe = BillboardEffect.make( vector, False, True, 0, lookAt, (0, 0, 0) )
     # Create an arc
     arc = Arc( numSegs=32, degrees=180, axis=Vec3(0, 0, 1) )
     #line = Line(start=Vec3(0,0,0), end=Vec3(0, 0, 1))
     arc.setH( 180 )
     arc.setEffect( bbe )
     # Create the axis from the arc
     axis = Axis( self.name, vector, colour )
     axis.AddGeometry( arc, sizeStyle=SCALE , vector=str(vector))
     #axis.AddGeometry( line, sizeStyle=SCALE )
     axis.AddCollisionSolid( self.collSphere, sizeStyle=SCALE, vector=str(vector))
     axis.reparentTo( self )
     #==
     line = Line( (0, 0, 0), vector )
     cone = Cone( 0.05, 0.25, axis=vector, origin=vector * 0.25 )
     axis.AddGeometry( line, sizeStyle=SCALE )
     axis.AddGeometry( cone, vector, colour )
     #==
     return axis
Exemplo n.º 4
0
 def CreateRing( self, vector, colour, rot ):
     
     # Create an arc
     arc = Arc( numSegs=32, degrees=180, axis=Vec3(0, 0, 1) )
     arc.setH( 180 )
     
     # Create the axis from the arc
     axis = Axis( self.name, vector, colour )
     axis.AddGeometry( arc, sizeStyle=SCALE )
     axis.AddCollisionSolid( self.collSphere, sizeStyle=SCALE )
     axis.reparentTo( self )
     
     # Create the billboard effect and apply it to the arc. We need an
     # extra NodePath to help the billboard effect so it orients properly.
     hlpr = NodePath( 'helper' )
     hlpr.setHpr( rot )
     hlpr.reparentTo( self )
     arc.reparentTo( hlpr )
     bbe = BillboardEffect.make( Vec3(0, 0, 1), False, True, 0, 
                                 self.camera, (0, 0, 0) )
     arc.setEffect( bbe )
     
     return axis
Exemplo n.º 5
0
    def setupHpMeter(self):
        if self.hpMeter:
            return None

        zAdj = 50
        self.smokeZAdj = zAdj
        self.fortPart = self.fortNode.find("**/top_interior_wall_collision")
        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find("**/col_TopFloor1")

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find("**/pPlane4")
            zAdj = 150
            self.smokeZAdj = 100

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find("**/*tower*")

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find("**/*buttress*")

        if self.fortPart.isEmpty():
            self.fortPart = self.fortNode.find("**/*floor*")

        fortPartBounds = self.fortPart.getBounds()
        self.hpAnchor = NodePath("hpAnchor")
        self.hpAnchor.setPos(fortPartBounds.getApproxCenter())
        self.hpAnchor.setZ(self.hpAnchor.getZ() + zAdj)
        self.hpAnchor.reparentTo(self.fortNode)
        self.hpMeter = HpMeter.HpMeter(fadeOut=0, parent=self.hpAnchor, originAtMidPt=True)
        self.hpMeter.setScale(200)
        self.hpMeter.setBin("fixed", 130)
        self.hpMeter.setDepthWrite(False)
        myEffect = BillboardEffect.make(Vec3(0, 0, 1), True, False, 150, NodePath(), Point3(0, 0, 0))
        self.hpMeter.node().setEffect(myEffect)
        self.hpMeter.update(self.hp, self.maxHp)
        self.hideFortHpMeter()