Exemplo n.º 1
0
def EnterZone3Proximity(e):
 global SWIM_ZONE_TO_ZONE_COMPLETE_EVENT
 
# print "entered......................"
 
 #turning off swimming
 transport_vhil.onKeyDown('g')
 
 #raise the custom completion event
 viz.sendEvent(SWIM_ZONE_TO_ZONE_COMPLETE_EVENT)
Exemplo n.º 2
0
def swimFromZoneToZone():
 global SWIM_ZONE_TO_ZONE_COMPLETE_EVENT, LOOKED_OPENING_EVENT, lookingOpeningTimer, skipKey
 yield viztask.waitEvent(scavengerhunt.ZONE1_OVER_EVENT)
 scavengerhunt.disableGrabber()
 globals_oa.ZONE1_AUDIO_1.stop()
 globals_oa.basket.disable(viz.RENDERING)
 
 # Uncomment next block for immediately fading to zone 3 from zone 1; comment out lines 783 to 881 to skip swimming through the trench
# yield fader.fadeOutTask()
# for school in schooling.all_fish_schools:
#  school.hidePercentage(50)
# globals_oa.currentZoneNumber = 2
# transport_vhil.cycleZones()
# yield fader.fadeInTask()

 #get the child of the zone1 to hide
 stuffToHide1 = globals_oa.terrainZone1.getChild('RemoveThisWall')
 stuffToHide1.visible(False)

 playAudioAndSaveGlobalPointer(globals_oa.ZONE3_TRANSITION)
 result = yield viztask.waitAny([viztask.waitMediaEnd(globals_oa.ZONE3_TRANSITION), skipKey])
 markAudioPlayAsEnded()
 if result.condition is skipKey:
  globals_oa.ZONE3_TRANSITION.stop()
 #playAudioAndSaveGlobalPointer(globals_oa.ZONE3_TRANSITION2)
 #yield viztask.waitMediaEnd(globals_oa.ZONE3_TRANSITION2)
 #markAudioPlayAsEnded()
 
 vizact.onkeydown('q', shootForward)
# viz.phys.disable()
 
 # Waits until the user has looked at the opening for 2 seconds before it starts swimming instructions
 viz.setCollectRenderStats(True)
 lookingOpeningTimer = vizact.ontimer(0.1, lookingAtOpening)
 yield viztask.waitAny([viztask.waitEvent(LOOKED_OPENING_EVENT), skipKey])

 
 #create proximity sensor for the swimming between zones
 swimBetweenZonesProximityManager = vizproximity.Manager()
# swimBetweenZonesProximityManager.setDebug(viz.ON)
 
 swimBetweenZonesProximityTarget = vizproximity.Target(viz.MainView)
 swimBetweenZonesProximityManager.addTarget(swimBetweenZonesProximityTarget)
 
 #create a box to act as the end of tunnel sensor, for zone-to-zone swimming
 endOfTunnelBox = vizshape.addBox(size = [3.0, 3.0, 3.0])
 endOfTunnelBox.setPosition(globals_oa.CURRENT_ABS_POS_OF_END_OF_ZONE_TO_ZONE_TUNNEL)
 endOfTunnelBox.visible(False)
 zone3Sensor = vizproximity.addBoundingBoxSensor(endOfTunnelBox)
 swimBetweenZonesProximityManager.addSensor(zone3Sensor)
 
 swimBetweenZonesProximityManager.onEnter(zone3Sensor, EnterZone3Proximity)
 
 #create a sensor around the tube through the tunnel
 tunnelBox1 = globals_oa.terrainZone1.getChild('Box001')
 tunnelBox2 = globals_oa.terrainZone1.getChild('Box002')
 tunnelBox3 = globals_oa.terrainZone1.getChild('Box003')
 tunnelBox4 = globals_oa.terrainZone1.getChild('Box004')
 
 tunnelBox1.visible(False)
 tunnelBox2.visible(False)
 tunnelBox3.visible(False)
 tunnelBox4.visible(False)

 tunnelBoxSensor1 = vizproximity.addBoundingBoxSensor(tunnelBox1)
 tunnelBoxSensor2 = vizproximity.addBoundingBoxSensor(tunnelBox2)
 tunnelBoxSensor3 = vizproximity.addBoundingBoxSensor(tunnelBox3)
 tunnelBoxSensor4 = vizproximity.addBoundingBoxSensor(tunnelBox4)
 
 boundingBox = stuffToHide1.getBoundingBox()
 trackerLink = viz.link(stuffToHide1, viz.NullLinkable)
 tunnelOpeningSensor = vizproximity.Sensor(vizproximity.Box([boundingBox.width * 0.6, boundingBox.height * 0.3, boundingBox.depth * 1.2], 
 [boundingBox.center[0] + 2.2, boundingBox.center[1], boundingBox.center[2] + 2]), trackerLink)
 
 swimBetweenZonesProximityManager.addSensor(tunnelBoxSensor1)
 swimBetweenZonesProximityManager.addSensor(tunnelBoxSensor2)
 swimBetweenZonesProximityManager.addSensor(tunnelBoxSensor3)
 swimBetweenZonesProximityManager.addSensor(tunnelBoxSensor4)
 swimBetweenZonesProximityManager.addSensor(tunnelOpeningSensor)
 swimBetweenZonesProximityManager.onEnter(tunnelBoxSensor1, EnterTunnelTube)
 swimBetweenZonesProximityManager.onEnter(tunnelBoxSensor2, EnterTunnelTube)
 swimBetweenZonesProximityManager.onEnter(tunnelBoxSensor3, EnterTunnelTube)
 swimBetweenZonesProximityManager.onEnter(tunnelBoxSensor4, EnterTunnelTube)
 swimBetweenZonesProximityManager.onEnter(tunnelOpeningSensor, EnterTunnelOpening)
 swimBetweenZonesProximityManager.onExit(tunnelBoxSensor1, ExitTunnelTube)
 swimBetweenZonesProximityManager.onExit(tunnelBoxSensor2, ExitTunnelTube)
 swimBetweenZonesProximityManager.onExit(tunnelBoxSensor3, ExitTunnelTube)
 swimBetweenZonesProximityManager.onExit(tunnelBoxSensor4, ExitTunnelTube)
 swimBetweenZonesProximityManager.onExit(tunnelOpeningSensor, ExitTunnelOpening)
 
 #turning on swimming
 transport_vhil.onKeyDown('g')
 
 playAudioAndSaveGlobalPointer(globals_oa.SWIMMING_INSTRUCTIONS)
 viztask.schedule(swimTutorial)
 viztask.schedule(removeGhostHands)
 result = yield viztask.waitAny([viztask.waitMediaEnd(globals_oa.SWIMMING_INSTRUCTIONS), skipKey])
 markAudioPlayAsEnded()
 if result.condition is skipKey:
  globals_oa.SWIMMING_INSTRUCTIONS.stop()
 
# print "waiting for swimming to end"
 yield viztask.waitAny([viztask.waitEvent(SWIM_ZONE_TO_ZONE_COMPLETE_EVENT), skipKey])
 viztask.schedule(startZone3Hunt())