[4561] | 1 | -- Main trigger |
---|
[4555] | 2 | trigger = ScriptTrigger() -- Create the trigger |
---|
| 3 | trigger:setScript("cutscene.lua") -- Tell the trigger which script to call |
---|
| 4 | trigger:setFunction("tick") -- Tell the trigger which scriptfunction to call |
---|
[4561] | 5 | trigger:setActiveOnCreation(true) |
---|
| 6 | |
---|
| 7 | -- Cameraswitchone |
---|
| 8 | triggerOne = ScriptTrigger() |
---|
| 9 | triggerOne:setScript("cutscene.lua") |
---|
| 10 | triggerOne:setFunction("switchCamTargetToEarth") |
---|
[4563] | 11 | triggerOne:setAbsCoor(0 , 0 , -50) |
---|
[4561] | 12 | triggerOne:setTarget("CameraOne") |
---|
[4563] | 13 | triggerOne:setRadius(10) |
---|
[4561] | 14 | triggerOne:setDebugDraw(true) |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | -- Cameraswitchtwo |
---|
| 18 | triggerTwo = ScriptTrigger() |
---|
| 19 | triggerTwo:setScript("cutscene.lua") |
---|
| 20 | triggerTwo:setFunction("switchCamToSpaceship") |
---|
[4570] | 21 | triggerTwo:setAbsCoor(0, 0 , 150) |
---|
[4563] | 22 | triggerTwo:setTarget("CameraOne") |
---|
| 23 | triggerTwo:setRadius(5) |
---|
[4561] | 24 | triggerTwo:setDebugDraw(true) |
---|
| 25 | |
---|
| 26 | -- Cameraswitchthree |
---|
| 27 | triggerThree = ScriptTrigger() |
---|
| 28 | triggerThree:setScript("cutscene.lua") |
---|
| 29 | triggerThree:setFunction("switchCamToStation") |
---|
[4563] | 30 | triggerThree:setAbsCoor(-125, 0 , 175) |
---|
| 31 | triggerThree:setTarget("CameraOne") |
---|
| 32 | triggerThree:setRadius(5) |
---|
[4561] | 33 | triggerThree:setDebugDraw(true) |
---|
| 34 | |
---|
[4555] | 35 | |
---|
| 36 | -- Get objects from orxonox |
---|
| 37 | thisscript:addObject("CameraMan", "cameraManager") |
---|
[4561] | 38 | thisscript:addObject("NPC", "shutleOne") |
---|
[4569] | 39 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
[4555] | 40 | |
---|
[4569] | 41 | |
---|
[4561] | 42 | -- Global Variables |
---|
[4555] | 43 | time = 0 |
---|
[4570] | 44 | stationReached = false |
---|
| 45 | fadeout = false |
---|
[4568] | 46 | bInit = 0 |
---|
| 47 | bInit2 = 0 |
---|
[4555] | 48 | |
---|
[4561] | 49 | |
---|
[4563] | 50 | -- shutleOne |
---|
| 51 | shutle = { } |
---|
| 52 | --{ |
---|
| 53 | |
---|
| 54 | function shutle:tick(timestep) |
---|
| 55 | if cameraManager:getCurrCameraCoorZ() > 0 then |
---|
| 56 | coorX = shutleOne:getAbsCoorX() |
---|
| 57 | coorY = shutleOne:getAbsCoorY() |
---|
| 58 | coorZ = shutleOne:getAbsCoorZ() |
---|
| 59 | shutleOne:setAbsCoor(coorX-.06,coorY,coorZ) |
---|
| 60 | end |
---|
| 61 | end |
---|
| 62 | |
---|
| 63 | --} |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
[4561] | 67 | -- Switch cam functions |
---|
| 68 | function switchCamTargetToEarth(timestep) |
---|
| 69 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
| 70 | return true |
---|
| 71 | end |
---|
| 72 | |
---|
| 73 | function switchCamToSpaceship(timestep) |
---|
| 74 | cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne") |
---|
| 75 | return true |
---|
| 76 | end |
---|
| 77 | |
---|
| 78 | function switchCamToStation(timestep) |
---|
| 79 | cameraManager:atachCurrCameraToWorldEntity("Building", "zhara") |
---|
[4570] | 80 | stationReached = true |
---|
| 81 | time = 0 |
---|
[4563] | 82 | --cameraManager:detachCurrCamera() |
---|
[4561] | 83 | return true |
---|
| 84 | end |
---|
| 85 | |
---|
| 86 | |
---|
[4555] | 87 | -- THE tick function |
---|
| 88 | |
---|
| 89 | function tick(timestep) |
---|
| 90 | time = time + timestep |
---|
[4563] | 91 | |
---|
[4570] | 92 | shutle:tick(timestep) |
---|
| 93 | |
---|
[4568] | 94 | if bInit == 0 then |
---|
| 95 | cameraManager:initFadeBlack() |
---|
[4570] | 96 | gameWorld:showText("Earth Solar System"); |
---|
[4568] | 97 | bInit = 1 |
---|
| 98 | end |
---|
| 99 | |
---|
[4570] | 100 | if time > 2 and bInit2 == 0 then |
---|
[4568] | 101 | cameraManager:toggleFade() |
---|
| 102 | bInit2 = 1 |
---|
| 103 | end |
---|
| 104 | |
---|
[4563] | 105 | if not cameraSwitched then |
---|
[4561] | 106 | cameraManager:setCam("CameraOne") |
---|
[4563] | 107 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "shutleOne") |
---|
| 108 | cameraManager:changeCurrTarget("Planet", "Moon") |
---|
[4555] | 109 | cameraSwitched = true |
---|
[4563] | 110 | end |
---|
[4555] | 111 | |
---|
[4570] | 112 | if time > 4 and stationReached and not fadeout then |
---|
| 113 | cameraManager:toggleFade() |
---|
| 114 | fadeout = true |
---|
[4555] | 115 | end |
---|
| 116 | |
---|
[4570] | 117 | if time > 6 and stationReached then |
---|
| 118 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
| 119 | gameWorld:stop() |
---|
| 120 | return true |
---|
| 121 | end |
---|
| 122 | |
---|
[4555] | 123 | return false |
---|
| 124 | end |
---|