本文整理汇总了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)
示例2: announceGenerate
def announceGenerate(self):
DistributedSmoothNode.announceGenerate(self)
self.activateSmoothing(True, False)
self.startSmooth()
self.loadActor()
self.reparentTo(render)
示例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)
示例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)
示例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
示例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)
示例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)
示例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)
示例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
示例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
示例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)
示例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
示例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)
示例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)
示例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