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