本文整理汇总了Python中direct.controls.GravityWalker.GravityWalker.disableAvatarControls方法的典型用法代码示例。如果您正苦于以下问题:Python GravityWalker.disableAvatarControls方法的具体用法?Python GravityWalker.disableAvatarControls怎么用?Python GravityWalker.disableAvatarControls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.controls.GravityWalker.GravityWalker
的用法示例。
在下文中一共展示了GravityWalker.disableAvatarControls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: disableAvatarControls
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import disableAvatarControls [as 别名]
def disableAvatarControls(self):
GravityWalker.disableAvatarControls(self)
self.abortJump()
示例2: LocalToon
# 需要导入模块: from direct.controls.GravityWalker import GravityWalker [as 别名]
# 或者: from direct.controls.GravityWalker.GravityWalker import disableAvatarControls [as 别名]
#.........这里部分代码省略.........
animToPlay = None
timeToWait = 3.0
if attack not in ('pickpocket', 'fountainpen'):
suitH = suit.getH(render) % 360
myH = self.getH(render) % 360
if -90.0 <= suitH - myH <= 90.0:
animToPlay = 'fallFWD'
else:
animToPlay = 'fallBCK'
elif attack in ('pickpocket',):
animToPlay = 'cringe'
elif attack in ('fountainpen',):
animToPlay = 'conked'
timeToWait = 5.0
self.cr.playGame.getPlace().fsm.request('stop')
self.b_setAnimState(animToPlay)
base.taskMgr.doMethodLater(timeToWait, self.__attackReactionDone, 'LT.attackReactionDone')
return
def __attackReactionDone(self, task):
self.cr.playGame.hood.loader.place.fsm.request('walk')
self.b_setAnimState('neutral')
return Task.done
def enableAvatarControls(self):
self.walkControls.enableAvatarControls()
self.accept('control', self.updateMovementKeymap, ['jump', 1])
self.accept('control-up', self.updateMovementKeymap, ['jump', 0])
taskMgr.add(self.movementTask, 'avatarMovementTask')
self.avatarMovementEnabled = True
self.playMovementSfx(None)
return
def disableAvatarControls(self):
self.walkControls.disableAvatarControls()
self.ignore('arrow_up')
self.ignore('arrow_up-up')
self.ignore('arrow_down')
self.ignore('arrow_down-up')
self.ignore('arrow_left')
self.ignore('arrow_left-up')
self.ignore('arrow_right')
self.ignore('arrow_right-up')
self.ignore('control')
self.ignore('control-up')
taskMgr.remove('avatarMovementTask')
self.isMoving_forward = False
self.isMoving_side = False
self.isMoving_back = False
self.isMoving_jump = False
self.avatarMovementEnabled = False
self.playMovementSfx(None)
for k, _ in self.movementKeymap.items():
self.updateMovementKeymap(k, 0)
return
def updateMovementKeymap(self, key, value):
self.movementKeymap[key] = value
def getMovementKeyValue(self, key):
return self.movementKeymap[key]
def playMovementSfx(self, movement):
if movement == 'run':
self.walkSfx.stop()