当前位置: 首页>>代码示例>>Python>>正文


Python Interval.__init__方法代码示例

本文整理汇总了Python中Interval.Interval.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Interval.__init__方法的具体用法?Python Interval.__init__怎么用?Python Interval.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interval.Interval的用法示例。


在下文中一共展示了Interval.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
    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)
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:27,代码来源:TestInterval.py

示例2: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
    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)
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:62,代码来源:ParticleInterval.py

示例3: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
    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)
开发者ID:Wilee999,项目名称:TTRInjector,代码行数:62,代码来源:ProjectileInterval.py

示例4: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
 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
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:31,代码来源:ProjectileInterval.pyc.py

示例5: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
 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)
开发者ID:Toonerz,项目名称:Toontown-2003,代码行数:16,代码来源:ProjectileInterval.py

示例6: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
    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
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:26,代码来源:ParticleInterval.pyc.py

示例7: __init__

# 需要导入模块: from Interval import Interval [as 别名]
# 或者: from Interval.Interval import __init__ [as 别名]
    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)
开发者ID:Oldtiger5,项目名称:panda3d,代码行数:65,代码来源:ProjectileInterval.py


注:本文中的Interval.Interval.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。