當前位置: 首頁>>代碼示例>>Python>>正文


Python DistributedSmoothNode.DistributedSmoothNode類代碼示例

本文整理匯總了Python中direct.distributed.DistributedSmoothNode.DistributedSmoothNode的典型用法代碼示例。如果您正苦於以下問題:Python DistributedSmoothNode類的具體用法?Python DistributedSmoothNode怎麽用?Python DistributedSmoothNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DistributedSmoothNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: disable

    def disable(self):
        """ This method is called when the object is removed from the
        scene, for instance because it left the zone.  It is balanced
        against generate(): for each generate(), there will be a
        corresponding disable().  Everything that was done in
        generate() or announceGenerate() should be undone in disable().

        After a disable(), the object might be cached in memory in case
        it will eventually reappear.  The DistributedObject should be
        prepared to receive another generate() for an object that has
        already received disable().

        Note that the above is only strictly true for *cacheable*
        objects.  Most objects are, by default, non-cacheable; you
        have to call obj.setCacheable(True) (usually in the
        constructor) to make it cacheable.  Until you do this, your
        non-cacheable object will always receive a delete() whenever
        it receives a disable(), and it will never be stored in a
        cache.
        """

        # Stop the smooth task.
        self.stopSmooth()

        # Take it out of the scene graph.
        self.detachNode()

        if self.flushTask:
            taskMgr.remove(self.flushTask)
            self.flushTask = None

        DistributedSmoothNode.disable(self)
開發者ID:ToontownLittleCat,項目名稱:tagger,代碼行數:32,代碼來源:TagAvatar.py

示例2: announceGenerate

    def announceGenerate(self):
        DistributedSmoothNode.announceGenerate(self)
        self.activateSmoothing(True, False)
        self.startSmooth()

        self.loadActor()
        self.reparentTo(render)
開發者ID:ToontownLittleCat,項目名稱:dist-ralph,代碼行數:7,代碼來源:Ralph.py

示例3: delete

    def delete(self):
        # Stop the smooth task.
        self.stopSmooth()
        
        # Clean out self.model, so we don't have a circular reference.
        self.model = None

        DistributedSmoothNode.delete(self)
開發者ID:ToontownLittleCat,項目名稱:dist-ralph,代碼行數:8,代碼來源:Ralph.py

示例4: generate

 def generate(self):
     DistributedSmoothNode.generate(self)
     self.name = self.uniqueName('projectile')
     self.posHprBroadcastName = self.uniqueName('projectileBroadcast')
     geom = loader.loadModel('models/smiley')
     self.geom = geom
     self.geom.reparentTo(self)
     self.startSmooth()
     self.reparentTo(render)
開發者ID:MasterLoopyBM,項目名稱:c0d3,代碼行數:9,代碼來源:DistributedProjectile.py

示例5: __init__

 def __init__(self, cr):
     self.cr = cr
     Char.Char.__init__(self)
     DistributedSmoothNode.__init__(self, cr)
     self.name = ''
     self.anim = ''
     self.chat = ''
     self.charType = ''
     self.clerk = 0
開發者ID:coginvasion,項目名稱:src,代碼行數:9,代碼來源:DistributedChar.py

示例6: delete

 def delete(self):
     del self.name
     del self.charType
     del self.anim
     del self.chat
     if self.clerk:
         self.wb.remove_node()
         del self.wb
     Char.Char.delete(self)
     DistributedSmoothNode.delete(self)
開發者ID:coginvasion,項目名稱:src,代碼行數:10,代碼來源:DistributedChar.py

示例7: smoothPosition

    def smoothPosition(self):
        """
        This function updates the position of the node to its computed
        smoothed position.  This may be overridden by a derived class
        to specialize the behavior.
        """
        DistributedSmoothNode.smoothPosition(self)

        vel = self.smoother.getSmoothForwardVelocity()
        self.setMoving(vel != 0)
開發者ID:ToontownLittleCat,項目名稱:tagger,代碼行數:10,代碼來源:TagAvatar.py

示例8: generate

    def generate(self):
        """ This method is called when the object is generated: when it
        manifests for the first time on a particular client, or when it
        is pulled out of the cache after a previous manifestation.  At
        the time of this call, the object has been created, but its
        required fields have not yet been filled in. """

        # Always call up to parent class
        DistributedSmoothNode.generate(self)

        self.setPythonTag('avId', self.doId)
開發者ID:ToontownLittleCat,項目名稱:tagger,代碼行數:11,代碼來源:TagAvatar.py

示例9: __init__

    def __init__(self, cr):
        DistributedSmoothNode.__init__(self, cr)

        self.actor = None
        self.isMoving = False
        self.name = ''
        self.chat = ''
        self.nameText = None
        self.nameTextNP = None
        self.chatText = None
        self.chatTextNP = None
開發者ID:ToontownLittleCat,項目名稱:dist-ralph,代碼行數:11,代碼來源:Ralph.py

示例10: delete

    def delete(self):
        try:
            self.DistributedToon_deleted
        except:
            self.DistributedToon_deleted = 1
            self.tutDone = None
            self.stopSmooth()
            Toon.Toon.delete(self)
            DistributedAvatar.delete(self)
            DistributedSmoothNode.delete(self)

        return
開發者ID:coginvasion,項目名稱:src,代碼行數:12,代碼來源:DistributedToon.py

示例11: delete

    def delete(self):
        """ This method is called after disable() when the object is to
        be completely removed, for instance because the other user
        logged off.  We will not expect to see this object again; it
        will not be cached.  This is stronger than disable(), and the
        object may remove any structures it needs to in order to allow
        it to be completely deleted from memory.  This balances against
        __init__(): every DistributedObject that is created will
        eventually get delete() called for it exactly once. """

        # Clean out self.model, so we don't have a circular reference.
        self.model = None

        DistributedSmoothNode.delete(self)
開發者ID:ToontownLittleCat,項目名稱:tagger,代碼行數:14,代碼來源:TagAvatar.py

示例12: smoothPosition

 def smoothPosition(self):
     """ This gets called when the position update
     has been received.  It determines whether
     to animate the object or not. """
     DistributedSmoothNode.smoothPosition(self)
     if not self.isLocal():
         if self.smoother.getSmoothForwardVelocity() or self.smoother.getSmoothRotationalVelocity():
             if self.isMoving == False:
                 self.actor.loop("run")
                 self.isMoving = True
         else:
             if self.isMoving == True:
                 self.actor.stop()
                 self.actor.pose("walk", 5)
                 self.isMoving = False
開發者ID:ToontownLittleCat,項目名稱:dist-ralph,代碼行數:15,代碼來源:Ralph.py

示例13: __init__

    def __init__(self, cr, playerId = None):
        DistributedSmoothNode.__init__(self,cr)
        # you have to initialize NodePath.__init__() here because it is
        # not called in DistributedSmoothNode.__init__()
        NodePath.__init__(self, 'avatar')

        self.playerId = playerId

        self.setTag('paintType', 'avatar')

        # This point is in the middle of the avatar, for determining
        # paint normals and such.
        self.center = self.attachNewNode('center')
        self.center.setZ(0.5)

        self.lastPaintPoint = None
        self.paintDirty = False
        self.flushTask = None
        self.p = None
        self.tex = None

        # A dictionary of player -> count, showing the number of
        # pixels that each player has painted onto this avatar.
        self.players = {}

        self.actor = None
        self.nametag = None
        self.moving = False

        # This is true if this avatar represents the "local avatar",
        # the player at the keyboard, as opposed to a remote player.
        self.localAvatar = False

        # Create an "into" collision sphere so it becomes tangible.
        cs = CollisionSphere(0, 0, 0.5, 0.5)
        cnode = CollisionNode('cnode')
        cnode.addSolid(cs)
        self.cnp = self.attachNewNode(cnode)
        self.cnp.setCollideMask(Globals.AvatarBit)
開發者ID:ToontownLittleCat,項目名稱:tagger,代碼行數:39,代碼來源:TagAvatar.py

示例14: announceGenerate

    def announceGenerate(self):
        """ This method is called after generate(), after all of the
        required fields have been filled in.  At the time of this call,
        the distributed object is ready for use. """

        DistributedSmoothNode.announceGenerate(self)

        # We can activate smoothing on this avatar as soon as it's
        # generated.
        self.activateSmoothing(True, False)

        # We also need to start the smooth task, which computes the
        # new smoothed position every frame.  Let's keep this task
        # running as long as the avatar is generated.
        self.startSmooth()

        # Get a pointer to the associated TagPlayer object.  Since
        # there's no guarantee of order between the time TagPlayer and
        # TagAvatar are generated, we might have to wait for it.  The
        # RelatedObjectManager can do that for us.
        self.cr.relatedObjectMgr.requestObjects(
            [self.playerId], allCallback = self.manifestAvatar)
開發者ID:ToontownLittleCat,項目名稱:tagger,代碼行數:22,代碼來源:TagAvatar.py

示例15: __init__

    def __init__(self, cr):
        try:
            self.DistributedToon_initialized
            return
        except:
            self.DistributedToon_initialized = 1

        Toon.Toon.__init__(self, cr)
        DistributedAvatar.__init__(self, cr)
        DistributedSmoothNode.__init__(self, cr)
        self.questManager = QuestManager.QuestManager()
        self.token = -1
        self.ghost = 0
        self.puInventory = []
        self.equippedPU = -1
        self.backpackId = None
        self.backpack = None
        self.animState2animId = {}
        self.battleMeter = None
        for index in range(len(self.animFSM.getStates())):
            self.animState2animId[self.animFSM.getStates()[index].getName()] = index

        self.animId2animState = {v:k for k, v in self.animState2animId.items()}
        self.initAmmo = []
        self.initGagIds = []
        self.headMeter = None
        self.firstTimeChangingHP = True
        self.gagBPData = []
        self.quests = []
        self.tier = None
        self.questHistory = None
        self.busy = 1
        self.friends = None
        self.tutDone = 0
        self.hoodsDiscovered = []
        self.teleportAccess = []
        self.lastHood = 0
        return
開發者ID:coginvasion,項目名稱:src,代碼行數:38,代碼來源:DistributedToon.py


注:本文中的direct.distributed.DistributedSmoothNode.DistributedSmoothNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。