本文整理汇总了Python中direct.fsm.ClassicFSM.ClassicFSM.isInternalStateInFlux方法的典型用法代码示例。如果您正苦于以下问题:Python ClassicFSM.isInternalStateInFlux方法的具体用法?Python ClassicFSM.isInternalStateInFlux怎么用?Python ClassicFSM.isInternalStateInFlux使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.fsm.ClassicFSM.ClassicFSM
的用法示例。
在下文中一共展示了ClassicFSM.isInternalStateInFlux方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Toon
# 需要导入模块: from direct.fsm.ClassicFSM import ClassicFSM [as 别名]
# 或者: from direct.fsm.ClassicFSM.ClassicFSM import isInternalStateInFlux [as 别名]
#.........这里部分代码省略.........
if self.tokenIcon:
self.tokenIcon.show()
self.getShadow().show()
self.getNameTag().show()
self.getGeomNode().show()
def attachGun(self, gunName):
self.detachGun()
if gunName == 'pistol':
self.gun = loader.loadModel('phase_4/models/props/water-gun.bam')
self.gun.reparentTo(self.find('**/def_joint_right_hold'))
self.gun.setPos(Point3(0.28, 0.1, 0.08))
self.gun.setHpr(VBase3(85.6, -4.44, 94.43))
self.gunAttached = True
elif gunName == 'shotgun':
self.gun = loader.loadModel('phase_4/models/props/shotgun.egg')
self.gun.setScale(0.75)
self.gun.reparentTo(self.find('**/def_joint_right_hold'))
self.gun.setPos(Point3(-0.5, -0.2, 0.19))
self.gun.setHpr(Vec3(350, 272.05, 0))
color = random.choice([VBase4(1, 0.25, 0.25, 1), VBase4(0.25, 1, 0.25, 1), VBase4(0.25, 0.25, 1, 1)])
self.gun.setColorScale(color)
self.gunAttached = True
def detachGun(self):
if self.gun and self.gunAttached:
self.gun.removeNode()
self.gun = None
self.gunAttached = False
return
def stopAnimations(self):
if hasattr(self, 'animFSM'):
if not self.animFSM.isInternalStateInFlux():
self.animFSM.request('off')
else:
notify.warning('animFSM in flux, state=%s, not requesting off' % self.animFSM.getCurrentState().getName())
else:
notify.warning('animFSM has been deleted')
if self.track != None:
self.track.finish()
DelayDelete.cleanupDelayDeletes(self.track)
self.track = None
return
def disable(self):
try:
self.Toon_disabled
except:
self.Toon_disabled = 1
self.backpack = None
self.stopAnimations()
self.removeAdminToken()
ToonHead.delete(self)
self.deleteCurrentToon()
self.chatSoundDict = {}
return
def delete(self):
try:
self.Toon_deleted
except:
self.Toon_deleted = 1
del self.animFSM
self.forwardSpeed = None
示例2: Char
# 需要导入模块: from direct.fsm.ClassicFSM import ClassicFSM [as 别名]
# 或者: from direct.fsm.ClassicFSM.ClassicFSM import isInternalStateInFlux [as 别名]
class Char(Avatar.Avatar):
def __init__(self):
try:
self.Char_initialized
return
except:
self.Char_initialized = 1
Avatar.Avatar.__init__(self)
self.avatarType = CIGlobals.CChar
self.avatarName = None
self.currentAnim = None
self.charType = ''
self.eyes = loader.loadTexture('phase_3/maps/eyes1.jpg', 'phase_3/maps/eyes1_a.rgb')
self.closedEyes = loader.loadTexture('phase_3/maps/mickey_eyes_closed.jpg', 'phase_3/maps/mickey_eyes_closed_a.rgb')
self.animFSM = ClassicFSM('Char', [State('off', self.enterOff, self.exitOff),
State('neutral', self.enterNeutral, self.exitNeutral),
State('walk', self.enterWalk, self.exitWalk),
State('run', self.enterRun, self.exitRun)], 'off', 'off')
animStateList = self.animFSM.getStates()
self.animFSM.enterInitialState()
Avatar.Avatar.initializeBodyCollisions(self, self.avatarType, 3.5, 1)
return
def stopAnimations(self):
if hasattr(self, 'animFSM'):
if not self.animFSM.isInternalStateInFlux():
self.animFSM.request('off')
else:
notify.warning('animFSM in flux, state=%s, not requesting off' % self.animFSM.getCurrentState().getName())
else:
notify.warning('animFSM has been deleted')
def disable(self):
self.stopBlink()
self.stopAnimations()
Avatar.Avatar.disable(self)
def delete(self):
try:
self.Char_deleted
except:
self.Char_deleted = 1
del self.animFSM
Avatar.Avatar.delete(self)
def setChat(self, chatString):
if self.charType == CIGlobals.Mickey:
self.dial = base.audio3d.loadSfx('phase_3/audio/dial/mickey.wav')
elif self.charType == CIGlobals.Minnie:
self.dial = base.audio3d.loadSfx('phase_3/audio/dial/minnie.wav')
elif self.charType == CIGlobals.Goofy:
self.dial = base.audio3d.loadSfx('phase_6/audio/dial/goofy.wav')
base.audio3d.attachSoundToObject(self.dial, self)
self.dial.play()
Avatar.Avatar.setChat(self, chatString)
def setName(self, nameString, charName = None):
self.avatarName = nameString
Avatar.Avatar.setName(self, nameString, avatarType=self.avatarType, charName=charName)
def generateChar(self, charType):
self.charType = charType
if charType == CIGlobals.Mickey or charType == CIGlobals.Minnie:
self.loadModel('phase_3/models/char/' + charType.lower() + '-' + str(CIGlobals.ModelDetail(self.avatarType)) + '.bam')
self.loadAnims({'neutral': 'phase_3/models/char/' + charType.lower() + '-wait.bam',
'walk': 'phase_3/models/char/' + charType.lower() + '-walk.bam',
'run': 'phase_3/models/char/' + charType.lower() + '-run.bam',
'left-start': 'phase_3.5/models/char/' + charType.lower() + '-left-start.bam',
'left': 'phase_3.5/models/char/' + charType.lower() + '-left.bam',
'right-start': 'phase_3.5/models/char/' + charType.lower() + '-right-start.bam',
'right': 'phase_3.5/models/char/' + charType.lower() + '-right.bam'})
if charType == CIGlobals.Mickey:
self.mickeyEye = self.controlJoint(None, 'modelRoot', 'joint_pupilR')
self.mickeyEye.setY(0.025)
for bundle in self.getPartBundleDict().values():
bundle = bundle['modelRoot'].getBundle()
earNull = bundle.findChild('sphere3')
if not earNull:
earNull = bundle.findChild('*sphere3')
earNull.clearNetTransforms()
for bundle in self.getPartBundleDict().values():
charNodepath = bundle['modelRoot'].partBundleNP
bundle = bundle['modelRoot'].getBundle()
earNull = bundle.findChild('sphere3')
if not earNull:
earNull = bundle.findChild('*sphere3')
ears = charNodepath.find('**/sphere3')
if ears.isEmpty():
ears = charNodepath.find('**/*sphere3')
ears.clearEffect(CharacterJointEffect.getClassType())
earRoot = charNodepath.attachNewNode('earRoot')
earPitch = earRoot.attachNewNode('earPitch')
earPitch.setP(40.0)
ears.reparentTo(earPitch)
earNull.addNetTransform(earRoot.node())
ears.clearMat()
ears.node().setPreserveTransform(ModelNode.PTNone)
#.........这里部分代码省略.........