Esempio n. 1
0
    def __init__(self,
                 particleEffect,
                 duration=0.0,
                 parent=None,
                 renderParent=None,
                 name=None):
        """
        particleEffect is ??
        parent is ??
        worldRelative is a boolean
        loop is a boolean
        duration is a float for the time
        name is ??
        """
        # Generate unique name
        id = 'Particle-%d' % TestInterval.particleNum
        TestInterval.particleNum += 1
        if name == None:
            name = id
        # Record instance variables
        self.particleEffect = particleEffect
        self.parent = parent
        self.renderParent = renderParent

        Interval.__init__(self, name, duration)
    def __init__(self,
                 particleEffect,
                 duration=0.0,
                 parent = None,
                 renderParent = None,
                 name=None):
        """
        particleEffect is ??
        parent is ??
        worldRelative is a boolean
        loop is a boolean
        duration is a float for the time
        name is ??
        """
        # Generate unique name
        id = 'Particle-%d' % TestInterval.particleNum
        TestInterval.particleNum += 1
        if name == None:
            name = id
        # Record instance variables
        self.particleEffect = particleEffect
        self.parent = parent
        self.renderParent = renderParent

        Interval.__init__(self, name, duration)
    def __init__(self,
                 particleEffect,
                 parent,
                 worldRelative = 1,
                 renderParent = None,
                 duration = 0.0,
                 softStopT = 0.0,
                 cleanup = False,
                 name = None):
        """
        particleEffect is a ParticleEffect
        parent is a NodePath: this is where the effect will be
                              parented in the scenegraph
        worldRelative is a boolean: this will override 'renderParent'
                                    with render
        renderParent is a NodePath: this is where the particles will
                                    be rendered in the scenegraph
        duration is a float: for the time
        softStopT is a float: no effect if 0.0,
                              a positive value will count from the
                              start of the interval,
                              a negative value will count from the
                              end of the interval
        cleanup is a boolean: if True the effect will be destroyed
                              and removed from the scenegraph upon
                              interval completion
                              set to False if planning on reusing
                              the interval
        name is a string: use this for unique intervals so that
                          they can be easily found in the taskMgr
        """
        
        # Generate unique name
        id = 'Particle-%d' % ParticleInterval.particleNum
        ParticleInterval.particleNum += 1
        if name == None:
            name = id
        # Record instance variables
        self.particleEffect = particleEffect 
        self.cleanup = cleanup

        if parent != None:
            self.particleEffect.reparentTo(parent)
        if worldRelative:
            renderParent = render
        if renderParent:
            for particles in self.particleEffect.getParticlesList():
                particles.setRenderParent(renderParent.node())

        self.__softStopped = False
        
        if softStopT == 0.0:
            self.softStopT = duration
        elif softStopT < 0.0:
            self.softStopT = duration+softStopT
        else:
            self.softStopT = softStopT
            
        # Initialize superclass
        Interval.__init__(self, name, duration)
    def __init__(self,
                 particleEffect,
                 parent,
                 worldRelative=1,
                 renderParent=None,
                 duration=0.0,
                 softStopT=0.0,
                 cleanup=False,
                 name=None):
        """
        particleEffect is a ParticleEffect
        parent is a NodePath: this is where the effect will be
                              parented in the scenegraph
        worldRelative is a boolean: this will override 'renderParent'
                                    with render
        renderParent is a NodePath: this is where the particles will
                                    be rendered in the scenegraph
        duration is a float: for the time
        softStopT is a float: no effect if 0.0,
                              a positive value will count from the
                              start of the interval,
                              a negative value will count from the
                              end of the interval
        cleanup is a boolean: if True the effect will be destroyed
                              and removed from the scenegraph upon
                              interval completion
                              set to False if planning on reusing
                              the interval
        name is a string: use this for unique intervals so that
                          they can be easily found in the taskMgr
        """

        # Generate unique name
        id = 'Particle-%d' % ParticleInterval.particleNum
        ParticleInterval.particleNum += 1
        if name == None:
            name = id
        # Record instance variables
        self.particleEffect = particleEffect
        self.cleanup = cleanup

        if parent != None:
            self.particleEffect.reparentTo(parent)
        if worldRelative:
            renderParent = render
        if renderParent:
            for particles in self.particleEffect.getParticlesList():
                particles.setRenderParent(renderParent.node())

        self.__softStopped = False

        if softStopT == 0.0:
            self.softStopT = duration
        elif softStopT < 0.0:
            self.softStopT = duration + softStopT
        else:
            self.softStopT = softStopT

        # Initialize superclass
        Interval.__init__(self, name, duration)
Esempio n. 5
0
    def __init__(
        self,
        node,
        startPos=None,
        endPos=None,
        duration=None,
        startVel=None,
        endZ=None,
        wayPoint=None,
        timeToWayPoint=None,
        gravityMult=None,
        name=None,
    ):
        """
        You may specify several different sets of input parameters.
        (If startPos is not provided, it will be obtained from the node's
        position at the time that the interval is first started. Note that
        in this case you must provide a duration of some kind.)
        
        # go from startPos to endPos in duration seconds
        startPos, endPos, duration
        # given a starting velocity, go for a specific time period
        startPos, startVel, duration
        # given a starting velocity, go until you hit a given Z plane
        startPos, startVel, endZ
        # pass through wayPoint at time 'timeToWayPoint'. Go until
        # you hit a given Z plane
        startPos, wayPoint, timeToWayPoint, endZ
        
        You may alter gravity by providing a multiplier in 'gravityMult'.
        '2.' will make gravity twice as strong, '.5' half as strong.
        '-1.' will reverse gravity
        """
        self.node = node

        if name == None:
            name = "%s-%s" % (self.__class__.__name__, self.projectileIntervalNum)
            ProjectileInterval.projectileIntervalNum += 1

            """
            # attempt to add info about the caller
            file, line, func = PythonUtil.callerInfo()
            if file is not None:
                name += '-%s:%s:%s' % (file, line, func)
            """

        args = (startPos, endPos, duration, startVel, endZ, wayPoint, timeToWayPoint, gravityMult)
        self.implicitStartPos = 0
        if startPos is None:
            if duration is None:
                self.notify.error("must provide either startPos or duration")
            self.duration = duration
            # we can't calc the trajectory until we know our starting
            # position; delay until the interval is actually started
            self.trajectoryArgs = args
            self.implicitStartPos = 1
        else:
            self.__calcTrajectory(*args)

        Interval.__init__(self, name, self.duration)
    def __init__(self,
                 particleEffect,
                 parent,
                 worldRelative=1,
                 renderParent=None,
                 duration=0.0,
                 softStopT=0.0,
                 cleanup=False,
                 name=None):
        id = 'Particle-%d' % ParticleInterval.particleNum
        ParticleInterval.particleNum += 1
        if name == None:
            name = id
        self.particleEffect = particleEffect
        self.cleanup = cleanup
        if parent != None:
            self.particleEffect.reparentTo(parent)
        if worldRelative:
            renderParent = render
        if renderParent:
            for particles in self.particleEffect.getParticlesList():
                particles.setRenderParent(renderParent.node())

        self.__softStopped = False
        if softStopT == 0.0:
            self.softStopT = duration
        else:
            if softStopT < 0.0:
                self.softStopT = duration + softStopT
            else:
                self.softStopT = softStopT
        Interval.__init__(self, name, duration)
        return
 def __init__(self, node, startPos = None, endPos = None, duration = None, startVel = None, endZ = None, wayPoint = None, timeToWayPoint = None, gravityMult = None, name = None, collNode = None):
     self.node = node
     self.collNode = collNode
     if self.collNode:
         if isinstance(self.collNode, NodePath):
             self.collNode = self.collNode.node()
     if name == None:
         name = '%s-%s' % (self.__class__.__name__, self.projectileIntervalNum)
         ProjectileInterval.projectileIntervalNum += 1
     args = (startPos,
      endPos,
      duration,
      startVel,
      endZ,
      wayPoint,
      timeToWayPoint,
      gravityMult)
     self.implicitStartPos = 0
     if startPos is None:
         if duration is None:
             self.notify.error('must provide either startPos or duration')
         self.duration = duration
         self.trajectoryArgs = args
         self.implicitStartPos = 1
     else:
         self.trajectoryArgs = args
         self.__calcTrajectory(*args)
     Interval.__init__(self, name, self.duration)
     return
Esempio n. 8
0
 def __init__(self,
              node,
              startPos=None,
              endPos=None,
              duration=None,
              startVel=None,
              endZ=None,
              wayPoint=None,
              timeToWayPoint=None,
              gravityMult=None,
              name=None,
              collNode=None):
     self.node = node
     self.collNode = collNode
     if self.collNode:
         if isinstance(self.collNode, NodePath):
             self.collNode = self.collNode.node()
     if name == None:
         name = '%s-%s' % (self.__class__.__name__,
                           self.projectileIntervalNum)
         ProjectileInterval.projectileIntervalNum += 1
     args = (startPos, endPos, duration, startVel, endZ, wayPoint,
             timeToWayPoint, gravityMult)
     self.implicitStartPos = 0
     if startPos is None:
         if duration is None:
             self.notify.error('must provide either startPos or duration')
         self.duration = duration
         self.trajectoryArgs = args
         self.implicitStartPos = 1
     else:
         self.trajectoryArgs = args
         self.__calcTrajectory(*args)
     Interval.__init__(self, name, self.duration)
     return
    def __init__(self,
                 node,
                 startPos=None,
                 endPos=None,
                 duration=None,
                 startVel=None,
                 endZ=None,
                 wayPoint=None,
                 timeToWayPoint=None,
                 gravityMult=None,
                 name=None):
        """
        You may specify several different sets of input parameters.
        (If startPos is not provided, it will be obtained from the node's
        position at the time that the interval is first started. Note that
        in this case you must provide a duration of some kind.)
        
        # go from startPos to endPos in duration seconds
        startPos, endPos, duration
        # given a starting velocity, go for a specific time period
        startPos, startVel, duration
        # given a starting velocity, go until you hit a given Z plane
        startPos, startVel, endZ
        # pass through wayPoint at time 'timeToWayPoint'. Go until
        # you hit a given Z plane
        startPos, wayPoint, timeToWayPoint, endZ
        
        You may alter gravity by providing a multiplier in 'gravityMult'.
        '2.' will make gravity twice as strong, '.5' half as strong.
        '-1.' will reverse gravity
        """
        self.node = node

        if name == None:
            name = '%s-%s' % (self.__class__.__name__,
                              self.projectileIntervalNum)
            ProjectileInterval.projectileIntervalNum += 1
            """
            # attempt to add info about the caller
            file, line, func = PythonUtil.callerInfo()
            if file is not None:
                name += '-%s:%s:%s' % (file, line, func)
            """

        args = (startPos, endPos, duration, startVel, endZ, wayPoint,
                timeToWayPoint, gravityMult)
        self.implicitStartPos = 0
        if startPos is None:
            if duration is None:
                self.notify.error('must provide either startPos or duration')
            self.duration = duration
            # we can't calc the trajectory until we know our starting
            # position; delay until the interval is actually started
            self.trajectoryArgs = args
            self.implicitStartPos = 1
        else:
            self.__calcTrajectory(*args)

        Interval.__init__(self, name, self.duration)
Esempio n. 10
0
 def __init__(self, node, startPos = None, endPos = None, duration = None, startVel = None, endZ = None, gravityMult = None, name = None):
     self.node = node
     if name == None:
         name = '%s-%s' % (self.__class__.__name__, self.projectileIntervalNum)
         ProjectileInterval.projectileIntervalNum += 1
     
     args = (startPos, endPos, duration, startVel, endZ, gravityMult)
     self.needToCalcTraj = 0
     if startPos is None:
         self.trajectoryArgs = args
         self.needToCalcTraj = 1
     else:
         self._ProjectileInterval__calcTrajectory(*args)
     Interval.__init__(self, name, duration)
    def __init__(self,
                 node,
                 startPos=None,
                 endPos=None,
                 duration=None,
                 startVel=None,
                 endZ=None,
                 gravityMult=None,
                 name=None):
        self.node = node
        if name == None:
            name = '%s-%s' % (self.__class__.__name__,
                              self.projectileIntervalNum)
            ProjectileInterval.projectileIntervalNum += 1

        args = (startPos, endPos, duration, startVel, endZ, gravityMult)
        self.needToCalcTraj = 0
        if startPos is None:
            self.trajectoryArgs = args
            self.needToCalcTraj = 1
        else:
            self._ProjectileInterval__calcTrajectory(*args)
        Interval.__init__(self, name, duration)
Esempio n. 12
0
    def __init__(self, particleEffect, parent, worldRelative = 1, renderParent = None, duration = 0.0, softStopT = 0.0, cleanup = False, name = None):
        id = 'Particle-%d' % ParticleInterval.particleNum
        ParticleInterval.particleNum += 1
        if name == None:
            name = id
        self.particleEffect = particleEffect
        self.cleanup = cleanup
        if parent != None:
            self.particleEffect.reparentTo(parent)
        if worldRelative:
            renderParent = render
        if renderParent:
            for particles in self.particleEffect.getParticlesList():
                particles.setRenderParent(renderParent.node())

        self.__softStopped = False
        if softStopT == 0.0:
            self.softStopT = duration
        elif softStopT < 0.0:
            self.softStopT = duration + softStopT
        else:
            self.softStopT = softStopT
        Interval.__init__(self, name, duration)
        return
Esempio n. 13
0
    def __init__(self, node, startPos = None,
                 endPos = None, duration = None,
                 startVel = None, endZ = None,
                 wayPoint = None, timeToWayPoint = None,
                 gravityMult = None, name = None,
                 collNode = None):
        """
        You may specify several different sets of input parameters.
        (If startPos is not provided, it will be obtained from the node's
        position at the time that the interval is first started. Note that
        in this case you must provide a duration of some kind.)

        # go from startPos to endPos in duration seconds
        startPos, endPos, duration
        # given a starting velocity, go for a specific time period
        startPos, startVel, duration
        # given a starting velocity, go until you hit a given Z plane
        startPos, startVel, endZ
        # pass through wayPoint at time 'timeToWayPoint'. Go until
        # you hit a given Z plane
        startPos, wayPoint, timeToWayPoint, endZ

        You may alter gravity by providing a multiplier in 'gravityMult'.
        '2.' will make gravity twice as strong, '.5' half as strong.
        '-1.' will reverse gravity

        If collNode is not None, it should be an empty CollisionNode
        which will be filled with an appropriate CollisionParabola
        when the interval starts.  This CollisionParabola will be set
        to match the interval's parabola, and its t1, t2 values will
        be updated automatically as the interval plays.  It will *not*
        be automatically removed from the node when the interval
        finishes.

        """
        self.node = node
        self.collNode = collNode
        if self.collNode:
            if isinstance(self.collNode, NodePath):
                self.collNode = self.collNode.node()
            assert self.collNode.getNumSolids() == 0

        if name == None:
            name = '%s-%s' % (self.__class__.__name__,
                              self.projectileIntervalNum)
            ProjectileInterval.projectileIntervalNum += 1

        args = (startPos, endPos, duration, startVel, endZ,
                wayPoint, timeToWayPoint, gravityMult)
        self.implicitStartPos = 0
        if startPos is None:
            if duration is None:
                self.notify.error('must provide either startPos or duration')
            self.duration = duration
            # we can't calc the trajectory until we know our starting
            # position; delay until the interval is actually started
            self.trajectoryArgs = args
            self.implicitStartPos = 1
        else:
            self.trajectoryArgs = args
            self.__calcTrajectory(*args)

        Interval.__init__(self, name, self.duration)
    def __init__(self, node, startPos = None,
                 endPos = None, duration = None,
                 startVel = None, endZ = None,
                 wayPoint = None, timeToWayPoint = None,
                 gravityMult = None, name = None,
                 collNode = None):
        """
        You may specify several different sets of input parameters.
        (If startPos is not provided, it will be obtained from the node's
        position at the time that the interval is first started. Note that
        in this case you must provide a duration of some kind.)
        
        # go from startPos to endPos in duration seconds
        startPos, endPos, duration
        # given a starting velocity, go for a specific time period
        startPos, startVel, duration
        # given a starting velocity, go until you hit a given Z plane
        startPos, startVel, endZ
        # pass through wayPoint at time 'timeToWayPoint'. Go until
        # you hit a given Z plane
        startPos, wayPoint, timeToWayPoint, endZ
        
        You may alter gravity by providing a multiplier in 'gravityMult'.
        '2.' will make gravity twice as strong, '.5' half as strong.
        '-1.' will reverse gravity

        If collNode is not None, it should be an empty CollisionNode
        which will be filled with an appropriate CollisionParabola
        when the interval starts.  This CollisionParabola will be set
        to match the interval's parabola, and its t1, t2 values will
        be updated automatically as the interval plays.  It will *not*
        be automatically removed from the node when the interval
        finishes.
        
        """
        self.node = node
        self.collNode = collNode
        if self.collNode:
            if isinstance(self.collNode, NodePath):
                self.collNode = self.collNode.node()
            assert self.collNode.getNumSolids() == 0

        if name == None:
            name = '%s-%s' % (self.__class__.__name__,
                              self.projectileIntervalNum)
            ProjectileInterval.projectileIntervalNum += 1

            """
            # attempt to add info about the caller
            file, line, func = PythonUtil.callerInfo()
            if file is not None:
                name += '-%s:%s:%s' % (file, line, func)
            """

        args = (startPos, endPos, duration, startVel, endZ,
                wayPoint, timeToWayPoint, gravityMult)
        self.implicitStartPos = 0
        if startPos is None:
            if duration is None:
                self.notify.error('must provide either startPos or duration')
            self.duration = duration
            # we can't calc the trajectory until we know our starting
            # position; delay until the interval is actually started
            self.trajectoryArgs = args
            self.implicitStartPos = 1
        else:
            self.trajectoryArgs = args
            self.__calcTrajectory(*args)

        Interval.__init__(self, name, self.duration)