本文整理汇总了Python中toontown.pets.PetTraits类的典型用法代码示例。如果您正苦于以下问题:Python PetTraits类的具体用法?Python PetTraits怎么用?Python PetTraits使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PetTraits类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _initDBVals
def _initDBVals(self, ownerId, name = None, traitSeed = 0, dna = None, safeZone = ToontownGlobals.ToontownCentral):
self.b_setOwnerId(ownerId)
if name is None:
name = 'pet%s' % self.doId
self.b_setPetName(name)
self.b_setTraitSeed(traitSeed)
self.b_setSafeZone(safeZone)
traits = PetTraits.PetTraits(traitSeed, safeZone)
for traitName in PetTraits.getTraitNames():
setter = self.getSetterName(traitName, 'b_set')
self.__dict__[setter](traits.getTraitValue(traitName))
self.traits = traits
for component in PetMood.PetMood.Components:
setterName = self.getSetterName(component, 'b_set')
self.__dict__[setterName](0.0)
if not dna:
dna = PetDNA.getRandomPetDNA()
self.setDNA(dna)
self.b_setLastSeenTimestamp(self.getCurEpochTimestamp())
for component in PetMood.PetMood.Components:
self.setMoodComponent(component, 0.0)
self.b_setTrickAptitudes([])
return
开发者ID:nate97,项目名称:src,代码行数:26,代码来源:DistributedPetAI.py
示例2: __generateDistTraitFuncs
def __generateDistTraitFuncs(self):
for i in xrange(PetTraits.PetTraits.NumTraits):
traitName = PetTraits.getTraitNames()[i]
getterName = self.getSetterName(traitName, 'get')
b_setterName = self.getSetterName(traitName, 'b_set')
d_setterName = self.getSetterName(traitName, 'd_set')
setterName = self.getSetterName(traitName)
def traitGetter(i = i):
return self.traitList[i]
def b_traitSetter(value, setterName = setterName, d_setterName = d_setterName):
self.__dict__[d_setterName](value)
self.__dict__[setterName](value)
def d_traitSetter(value, setterName = setterName):
self.sendUpdate(setterName, [value])
def traitSetter(value, i = i):
self.traitList[i] = value
self.__dict__[getterName] = traitGetter
self.__dict__[b_setterName] = b_traitSetter
self.__dict__[d_setterName] = d_traitSetter
self.__dict__[setterName] = traitSetter
self.__funcsToDelete.append(getterName)
self.__funcsToDelete.append(b_setterName)
self.__funcsToDelete.append(d_setterName)
self.__funcsToDelete.append(setterName)
开发者ID:nate97,项目名称:src,代码行数:29,代码来源:DistributedPetAI.py
示例3: announceGenerate
def announceGenerate(self):
DistributedSmoothNodeAI.DistributedSmoothNodeAI.announceGenerate(self)
self._hasCleanedUp = False
self.setHasRequestedDelete(False)
self.b_setParent(ToontownGlobals.SPHidden)
self.lockedDown = 0
self.leashMode = 0
self.leashAvId = None
self.leashGoal = None
self.trickLogger = ServerEventBuffer.ServerEventMultiAccumulator(
self.air, 'petTricksPerformed', self.doId)
self.trickFailLogger = ServerEventBuffer.ServerEventMultiAccumulator(
self.air, 'petTricksFailed', self.doId)
self.feedLogger = ServerEventBuffer.ServerEventAccumulator(
self.air, 'petFeedings', self.doId)
self.scratchLogger = ServerEventBuffer.ServerEventAccumulator(
self.air, 'petScratchings', self.doId)
self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone)
if not hasattr(self, '_beingCreatedInDB'):
for i in xrange(len(self.traitList)):
value = self.traitList[i]
if value == 0.0:
traitName = PetTraits.getTraitNames()[i]
traitValue = self.traits.getTraitValue(traitName)
DistributedPetAI.notify.info(
"%s: initializing new trait '%s' to %s, seed=%s" %
(self.doId, traitName, traitValue, self.traitSeed))
setterName = self.getSetterName(traitName, 'b_set')
self.__dict__[setterName](traitValue)
self.mood = PetMood.PetMood(self)
if not self.active:
return
self.activated = 1
self.announceZoneChange(self.zoneId, ToontownGlobals.QuietZone)
self.b_setParent(ToontownGlobals.SPRender)
self.setPos(randFloat(-20, 20), randFloat(-20, 20), 0)
self.setH(randFloat(360))
if self.initialDNA:
self.setDNA(self.initialDNA)
for mood, value in self.requiredMoodComponents.items():
self.mood.setComponent(mood, value, announce=0)
self.requiredMoodComponents = {}
self.brain = PetBrain.PetBrain(self)
self.mover = PetMoverAI(self)
self.enterPetLook()
self.actionFSM = PetActionFSM.PetActionFSM(self)
self.teleportIn()
self.handleMoodChange(distribute=0)
taskMgr.doMethodLater(
simbase.petMovePeriod *
random.random(),
self.move,
self.getMoveTaskName())
self.startPosHprBroadcast()
self.accept(PetObserve.getEventName(self.zoneId), self.brain.observe)
self.accept(self.mood.getMoodChangeEvent(), self.handleMoodChange)
self.mood.start()
self.brain.start()
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:60,代码来源:DistributedPetAI.py
示例4: __generateDistTraitFuncs
def __generateDistTraitFuncs(self):
for i in xrange(PetTraits.PetTraits.NumTraits):
traitName = PetTraits.getTraitNames()[i]
setterName = self.getSetterName(traitName)
def traitSetter(value, self = self, i = i):
self.traitList[i] = value
self.__dict__[setterName] = traitSetter
self.__funcsToDelete.append(setterName)
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:10,代码来源:DistributedPetProxy.py
示例5: generate
def generate(self):
DistributedObjectAI.DistributedObjectAI.generate(self)
self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone)
for i in xrange(len(self.traitList)):
value = self.traitList[i]
if value == 0.0:
traitName = PetTraits.getTraitNames()[i]
traitValue = self.traits.getTraitValue(traitName)
DistributedPetProxyAI.notify.info("%s: initializing new trait '%s' to %s, seed=%s" % (self.doId,
traitName,
traitValue,
self.traitSeed))
setterName = self.getSetterName(traitName, 'b_set')
self.__dict__[setterName](traitValue)
self.mood = PetMood.PetMood(self)
for mood, value in self.requiredMoodComponents.items():
self.mood.setComponent(mood, value, announce=0)
self.requiredMoodComponents = {}
self.accept(self.mood.getMoodChangeEvent(), self.handleMoodChange)
self.mood.start()
开发者ID:MasterLoopyBM,项目名称:Toontown,代码行数:22,代码来源:DistributedPetProxyAI.py
注:本文中的toontown.pets.PetTraits类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论