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


Python GravityWalker.disableAvatarControls方法代碼示例

本文整理匯總了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()
開發者ID:Puggyblue999,項目名稱:PiratesOfTheCarribeanOnline,代碼行數:5,代碼來源:PiratesGravityWalker.py

示例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()
開發者ID:coginvasion,項目名稱:src,代碼行數:70,代碼來源:LocalToon.py


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