Beispiel #1
0
    def __init__(self, sourceId, targetId, type, name):

        FlyingGag.__init__(self, "flyingGag", base.race.pie)

        self.billboard=False
        self.race = base.race
        self.scale=1
        self.imHitMult=1
        self.wallCollideTrack = None
        self.curSpeed = 0
        self.acceleration = 0
        self.count = 0
        self.name = name
        self.physicsObj = None
        self.ownerId = sourceId
        self.targetId = targetId
        self.ownerAv = None
        self.ownerKart = None
        self.hasTarget = 0
        self.deleting = 0
        self.d2t = 0
        self.lastD2t = 0
        self.startTime = globalClock.getFrameTime()
        self.timeRatio = 0
        self.maxTime = 8
        self.rotH = randFloat(-360,360)
        self.rotP = randFloat(-90,90)
        self.rotR = randFloat(-90,90)

        print(("generating Pie %s" % (self.name)))

        self.ownerKart = base.cr.doId2do.get(base.race.kartMap.get(sourceId,None),None)
        if(targetId != 0):
            self.targetKart = base.cr.doId2do.get(base.race.kartMap.get(targetId,None),None)
            self.hasTarget = 1

        if(self.ownerId==localAvatar.doId):
            startPos=self.ownerKart.getPos(render)
        else:
            startPos=self.ownerKart.getPos(render)

        self.setPos(startPos[0], startPos[1], startPos[2])

        self.__setupCollisions()
        self.setupPhysics()
        self.__enableCollisions()

        self.forward=NodePath("forward")
        self.forward.setPos(0,1,0)

        self.splatTaskName = ("splatTask %s" % (self.name))

        if self.hasTarget:
            self.splatTask = taskMgr.doMethodLater(self.maxTime, self.splat, self.splatTaskName)
        else:
            self.splatTask = taskMgr.doMethodLater(self.maxTime / 2.5, self.splat, self.splatTaskName)

        ###########################################################
        # Add the piejectile to the scene
        self.reparentTo(render)
Beispiel #2
0
 def delete(self):
     taskMgr.remove(self.taskName)
     self.__undoCollisions()
     self.physicsMgr.clearLinearForces()
     FlyingGag.delete(self)
     self.deleting = 1
     self.ignoreAll()
 def delete(self):
     taskMgr.remove(self.taskName)
     self.__undoCollisions()
     self.physicsMgr.clearLinearForces()
     FlyingGag.delete(self)
     self.deleting = 1
     self.ignoreAll()
Beispiel #4
0
 def delete(self):
     print 'removing piejectile'
     taskMgr.remove(self.taskName)
     self._Piejectile__undoCollisions()
     self.physicsMgr.clearLinearForces()
     FlyingGag.delete(self)
     self.deleting = 1
     self.ignoreAll()
 def __init__(self, sourceId, targetId, type, name):
     FlyingGag.__init__(self, 'flyingGag', base.race.pie)
     self.billboard = False
     self.race = base.race
     self.scale = 1
     self.imHitMult = 1
     self.wallCollideTrack = None
     self.curSpeed = 0
     self.acceleration = 0
     self.count = 0
     self.name = name
     self.physicsObj = None
     self.ownerId = sourceId
     self.targetId = targetId
     self.ownerAv = None
     self.ownerKart = None
     self.hasTarget = 0
     self.deleting = 0
     self.d2t = 0
     self.lastD2t = 0
     self.startTime = globalClock.getFrameTime()
     self.timeRatio = 0
     self.maxTime = 8
     self.rotH = randFloat(-360, 360)
     self.rotP = randFloat(-90, 90)
     self.rotR = randFloat(-90, 90)
     print 'generating Pie %s' % self.name
     self.ownerKart = base.cr.doId2do.get(
         base.race.kartMap.get(sourceId, None), None)
     if targetId != 0:
         self.targetKart = base.cr.doId2do.get(
             base.race.kartMap.get(targetId, None), None)
         self.hasTarget = 1
     if self.ownerId == localAvatar.doId:
         startPos = self.ownerKart.getPos(render)
     else:
         startPos = self.ownerKart.getPos(render)
     self.setPos(startPos[0], startPos[1], startPos[2])
     self.__setupCollisions()
     self.setupPhysics()
     self.__enableCollisions()
     self.forward = NodePath('forward')
     self.forward.setPos(0, 1, 0)
     self.splatTaskName = 'splatTask %s' % self.name
     if self.hasTarget:
         self.splatTask = taskMgr.doMethodLater(
             self.maxTime, self.splat, self.splatTaskName)
     else:
         self.splatTask = taskMgr.doMethodLater(
             self.maxTime / 2.5, self.splat, self.splatTaskName)
     self.reparentTo(render)
     return