本文整理汇总了Python中viztask.schedule函数的典型用法代码示例。如果您正苦于以下问题:Python schedule函数的具体用法?Python schedule怎么用?Python schedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schedule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: custom_walk
def custom_walk(self, points):
self.points = points
self.place_points = 0
self.avatar.setPosition(points[0][0])
self.next_point = points[0][0]
self.next_speed = points[0][1]
viztask.schedule(self.start_custom_walk())
示例2: collision
def collision( self ):
#self.next_point = [self.next_point[0] - .1, 0, self.next_point[2] - .1] #get_quadrant(self.avatar.getPosition()).get_random_walk()#[self.avatar.getPosition()[0], 0, self.avatar.getPosition()[2] - 0.05]
yield viztask.addAction(self.avatar, vizact.waittime(0.5))
#self.avatar.lookat(self.next_point)
#yield viztask.addAction(self.avatar, vizact.waittime(1))
self.coll = 0
viztask.schedule(self.walk_around())
示例3: playStory
def playStory():
global selectedAvatar, playing, avs
if selectedAvatar.name == 'exit':
viztask.schedule(playBusCloseAudio)
else:
selectedAvatar.story.play()
playing = True
toOutput = 'Started listening to ' + selectedAvatar.name
dc.collect(toOutput)
yield viztask.waitMediaEnd(selectedAvatar.story)
playing = False
selectedAvatar.done = True
if selectedAvatar.name == 'son/father':
for avatar in avs:
if avatar.name == 'father/son':
avatar.done = True
break
if selectedAvatar.name == 'father/son':
for avatar in avs:
if avatar.name == 'son/father':
avatar.done = True
break
toOutput = 'Finished listening to ' + selectedAvatar.name
dc.collect(toOutput)
yield viztask.waitTime(0.1)
selectedAvatar = None
示例4: __init__
def __init__(self, dataset):
self.modeName = ''
self._maxThreads = 8
self._curThreads = 0
self._meshes = []
self._meshesByFilename = {}
self._keystones = []
self._proximityList = []
self._boundingBoxes = {}
self._keyBindings = []
self._inRange = []
self._meshesById = {}
self._boneInfo = None
self._closestBoneIdx = None
self._prevBoneIdx = None
self._lastGrabbed = None
self._lastMeshGrabbed = None
self._lastBoxGrabbed = None
self._highlighted = None
self._gloveLink = None
self._grabFlag = False
self._snapAttempts = 0
self._imploded = False
self._pointerTexture = model.pointer.getTexture()
self._pointerOrigColor = model.pointer.getColor()
# self.viewcube = puzzleView.viewCube()
viztask.schedule(self.load(dataset))
示例5: load
def load(self, dataset):
"""
Load datasets and initialize everything necessary to commence
the puzzle game.
"""
# Dataset
model.ds = bp3d.DatasetInterface()
# Proximity management
model.proxManager = vizproximity.Manager()
target = vizproximity.Target(model.pointer)
model.proxManager.addTarget(target)
model.proxManager.onEnter(None, self.EnterProximity)
model.proxManager.onExit(None, self.ExitProximity)
#Setup Key Bindings
self.bindKeys()
self.score = PuzzleScore(self.modeName)
# viztask.schedule(soundTask(glove))
self._meshesToLoad = model.ds.getOntologySet(dataset)
self._filesToPreSnap = model.ds.getPreSnapSet()
yield self.loadControl(self._meshesToLoad)
yield self.prepareMeshes()
yield self.preSnap()
yield self.setKeystone(1)
viztask.schedule(self.updateClosestBone())
示例6: startZone3Hunt
def startZone3Hunt():
global SWIM_ZONE_TO_ZONE_COMPLETE_EVENT
# yield viztask.waitEvent(scavengerhunt.ZONE1_OVER_EVENT)
# print "waiting for swimming to end"
# yield viztask.waitEvent(SWIM_ZONE_TO_ZONE_COMPLETE_EVENT)
# scavengerhunt.disableGrabber()
# globals_oa.basket.disable(viz.RENDERING)
yield fader.fadeOutTask()
globals_oa.AUDIO_ZONE_CUT_AMBIENT.play()
# globals_oa.ZONE3_TRANSITION.play()
#Untested fish hiding
# for school in schooling.all_fish_schools:
# chromis_chromis.hidePercentage(20)
# diplodus_annularis.hidePercentage(100)
# labrus_viridis.hidePercentage(100)
# sarpa_salpa.hidePercentage(20)
for school in schooling.all_fish_schools:
school.hidePercentage(50)
globals_oa.currentZoneNumber = 2
transport_vhil.cycleZones()
#viz.res.addPublishFile('data/speciesToFindZone3.txt')
#scavengerhunt.initialize(globals_oa.terrainZone3, globals_oa.filePathToSpeciesForScavengerHuntInZone3)
#Enable swimming
yield fader.fadeInTask()
globals_oa.AUDIO_ZONE3_AMBIENT.play()
yield viztask.waitTime(3)
globals_oa.ZONE3_AUDIO_1.play()
# playAudioAndSaveGlobalPointer(globals_oa.ZONE3_AUDIO_1)
viztask.schedule(startBoatOutro())
示例7: main
def main():
global masterTimerG, recordingTimer
setUp()
masterTimerG = vizact.ontimer(0, masterTimer)
#recordingTimer = vizact.ontimer(0, recordCurrentSubjectStatus)
if not KEYBOARD_NAVIGATE:
addKeyPresses()
else:
# Setup keyboard/mouse tracker
tracker = vizcam.addWalkNavigate(moveScale=10.0)
tracker.setPosition([0,1.8,0])
viz.link(tracker,viz.MainView)
viz.mouse.setVisible(False)
def printLocation():
print viz.MainView.getPosition(), viz.MainView.getEuler()
vizact.onkeydown('p', printLocation)
#Add Wiimote support
# wii = viz.add('wiimote.dle')
# #Connect to first available wiimote
# wiimote = wii.addWiimote()
# wiimote.led = wii.LED_4
# #Add button functions
# vizact.onsensordown(wiimote,wii.BUTTON_A,TurnFlyingOn)
# vizact.onsensordown(wiimote,wii.BUTTON_B,TurnFlyingOff)
# vizact.onsensordown(wiimote,wii.BUTTON_1,endChildHappy)
#
#Hacky bug fix below, I apologize -Mark
if not FLYING_F and YOKE_F:
viztask.schedule(fixStartHeliPos)
示例8: startThreeTouch
def startThreeTouch():
#Captures the initial timeFrame whent the cubes are set up.
global hfScoreTimes
# global startTime
# startTime = time.clock()
viztask.schedule(playThreeTouch)
print "scheduled the game at time = " + str(time.clock())
示例9: ExitProximity
def ExitProximity(e):
global lSelectedNode, rSelectedNode, lhandtarget, rhandtarget, molecExited, h2omodels, NUM_H2O
print "moleucle has left the building!!"
print "exit prox: ", lSelectedNode, rSelectedNode
#drop molecule to specified place
obj = None
if e.target == lhandtarget:
obj = lSelectedNode
lSelectedNode = None
moleculeManager.removeTarget(lhandtarget)
elif e.target == rhandtarget:
obj = rSelectedNode
rSelectedNode = None
moleculeManager.removeTarget(rhandtarget)
rhGrabber.removeItems([obj])
lhGrabber.removeItems([obj])
print obj
molecExited = True
'''x,y,z = (h2omodels[0]).getPosition()
x += .5
moveToH2O = vizact.moveTo([x,y,z] , speed = .75)
obj.addAction(moveToH2O)
print "should be moving!"'''
viztask.schedule(moveCO2toH2O(obj))
#start molecule combination animation
#hide and remove h20 and co2 molecules
'''obj.visible(viz.OFF)
示例10: __init__
def __init__(self):
#init canvas and create themes for the test panel
self.canvas = viz.addGUICanvas(align = viz.ALIGN_CENTER_CENTER)
self.canvas.setPosition(0,0,0)
viz.mouse.setVisible(False)
self.name = 'test'
self._theme = viz.Theme()
self._theme.borderColor = (0.1,0.1,0.1,1)
self._theme.backColor = (0.4,0.4,0.4,1)
self._theme.lightBackColor = (0.6,0.6,0.6,1)
self._theme.darkBackColor = (0.2,0.2,0.2,1)
self._theme.highBackColor = (0.2,0.2,0.2,1)
self._theme.textColor = (1,1,1,1)
self._theme.highTextColor = (1,1,1,1)
#initialize test panel
vizdlg.Panel.__init__(self, parent = self.canvas, theme = self._theme, align = viz.ALIGN_CENTER_TOP, fontSize = 15)
self.visible(viz.OFF)
self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]])
self.alpha(0.6)
# #title
title = vizdlg.TitleBar('INSTRUCTIONS')
self.addItem(title, align = viz.ALIGN_CENTER_TOP)
#bones to be snapped. source snapped to target.
source = 'a'*20
self.sourceText = viz.addTextbox(parent = self.canvas)
self.sourceText.setLength(1.5)
target = 'a'*20
self.targetText = viz.addTextbox(parent = self.canvas)
self.targetText.setLength(1.5)
#instructions
self.Instruct1 = self.addItem(viz.addText('Snap the: ', parent = self.canvas), align = viz.ALIGN_CENTER_TOP)
self.sourceCommand = self.addItem(self.sourceText, align = viz.ALIGN_CENTER_TOP)
self.Instruct2 = self.addItem(viz.addText('To the: ', parent = self.canvas), align = viz.ALIGN_CENTER_TOP)
self.targetCommand = self.addItem(self.targetText, align = viz.ALIGN_CENTER_TOP)
#render canvas
if config.dispMode == config.DisplayMode.monitor:
self.canvas.billboard(viz.BILLBOARD_YAXIS)
self.canvas.setPosition(-2,0,0)
self.canvas.setBackdrop(viz.ALIGN_CENTER_TOP)
if config.dispMode == config.DisplayMode.oculus:
bb = self.canvas.getBoundingBox()
self.canvas.setRenderWorldOverlay([bb.width*1, bb.height*1], fov = bb.height, distance = 0.4)
self.canvas.setPosition(0,0.05,0)
self.canvasViewPos = self.canvas.getPosition()
self.canvas.setEuler(0,15,0)
self.canvas.setPosition(0, -5, 0)
self.canvasHidePos = self.canvas.getPosition()
viztask.schedule(self.updatePanelPos())
vizact.onkeydown(viz.KEY_ESCAPE, self.toggle)
示例11: onCollideBegin
def onCollideBegin(e):
global people
for person in people:
if person.avatar == e.obj1:
person.coll = 1
person.avatar.clearActions()
viztask.schedule(person.collision())
示例12: MainTask
def MainTask():
"""Top level task that controls the game"""
# Display instructions and wait for key press to continue
yield DisplayInstructionsTask()
# Create panel to display trial results
resultPanel = vizinfo.InfoPanel("", align=viz.ALIGN_CENTER, fontSize=25, icon=False, key=None)
resultPanel.visible(False)
viztask.waitDirector(getData)
while True:
num_trials += 1
# Randomly choose hiding spots from list
locations = random.sample(HIDING_SPOTS, TRIAL_COUNT)
# Reset score
score = 0
UpdateScore(score)
# Go through each position
for pos in locations:
# Perform a trial
found = yield TrialTask(pos)
# Update score and display status text
if found:
viz.playSound("sounds/pigeon_catch.wav")
score += 1
total_score += 1
UpdateScore(score)
tracker.runAction(vizact.spinTo(point=pos, time=0.8, interpolate=vizact.easeOutStrong))
resultPanel.setText(TRIAL_SUCCESS)
else:
viz.playSound("sounds/pigeon_fly.wav")
viztask.schedule(FadeToGrayTask())
resultPanel.setText(TRIAL_FAIL)
# Display success/failure message
resultPanel.visible(True)
# Add delay before starting next trial
yield viztask.waitTime(TRIAL_DELAY)
resultPanel.visible(False)
# Disable gray effect
gray_effect.setEnabled(False)
viztask.waitDirector(writeScore, score)
# Display results and ask to quit or play again
resultPanel.setText(RESULTS.format(score, TRIAL_COUNT))
resultPanel.visible(True)
yield viztask.waitKeyDown(" ")
resultPanel.visible(False)
示例13: ExitProximity
def ExitProximity(e):
global lSelectedNode, rSelectedNode, lhandtarget, rhandtarget, molecExited, h2omodels, NUM_H2O
print "moleucle has left the building!!"
print "exit prox: ", lSelectedNode, rSelectedNode
#drop molecule to specified place
obj = None
if e.target == lhandtarget:
if lSelectedNode == None: return #If hand exits but has no molecule
obj = lSelectedNode
lSelectedNode = None
moleculeManager.removeTarget(lhandtarget)
elif e.target == rhandtarget:
if rSelectedNode == None: return #If hand exits but has no molecule
obj = rSelectedNode
rSelectedNode = None
moleculeManager.removeTarget(rhandtarget)
rhGrabber.removeItems([obj])
lhGrabber.removeItems([obj])
print obj
molecExited = True
x,y,z = (h2omodels[0]).getPosition()
x += .5
'''moveToH2O = vizact.moveTo([x,y,z] , speed = .75)
obj.addAction(moveToH2O)
print "should be moving!"'''
#viztask.schedule( fadeAndAppear() )
viztask.schedule(moveCO2toH2O(obj))
#moveCO2 = vizact.moveTo([x,y,z],speed = .75 )
#obj.addAction(moveCO2)
'''co2 = obj
print "in moveCO2toH20", co2
#global h2omodels, NUM_H2O
x,y,z = (h2omodels[0]).getPosition()
x += .3
moveToH2O = vizact.moveTo([x,y,z] , speed = 1.75)
print x,y,z
print (h2omodels[0]).getPosition()
#viztask.addAction(co2, vizact.move(x,y,z,2))
sequence = vizact.sequence(moveToH2O, vizact.waittime(4), vizact.fadeTo(0, time = 1))
yield co2.add(sequence)
print "should be moving!"
#yield viztask.waitTime(2)
#"before turning off co2"
#co2.visible(viz.OFF)
h2omodels[0].visible(viz.OFF)
print "before removing h20"
h2omodels.remove(h2omodels[0])
NUM_H2O -= 1 '''
print "past viztask in exit prox"
#start molecule combination animation
#hide and remove h20 and co2 molecules
'''obj.visible(viz.OFF)
示例14: disable
def disable():
global enabled
global selector
if enabled:
selector.disable()
enabled = False
viztask.schedule(playBusCloseAudio())
示例15: enable
def enable():
global started, enabled
global selector
if not started:
viztask.schedule(begin())
started = True
enabled = True