[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) |
---|
[4603] | 15 | --triggerZero:setDebugDraw(true) |
---|
[4582] | 16 | |
---|
| 17 | |
---|
[4561] | 18 | -- Cameraswitchone |
---|
| 19 | triggerOne = ScriptTrigger() |
---|
| 20 | triggerOne:setScript("cutscene.lua") |
---|
| 21 | triggerOne:setFunction("switchCamTargetToEarth") |
---|
[4587] | 22 | triggerOne:setAbsCoor(5 , 0 , -140) |
---|
[4561] | 23 | triggerOne:setTarget("CameraOne") |
---|
[4563] | 24 | triggerOne:setRadius(10) |
---|
[4603] | 25 | --triggerOne:setDebugDraw(true) |
---|
[4561] | 26 | |
---|
| 27 | |
---|
| 28 | -- Cameraswitchtwo |
---|
| 29 | triggerTwo = ScriptTrigger() |
---|
| 30 | triggerTwo:setScript("cutscene.lua") |
---|
| 31 | triggerTwo:setFunction("switchCamToSpaceship") |
---|
[4593] | 32 | triggerTwo:setAbsCoor(0, 0 , -25) |
---|
[4563] | 33 | triggerTwo:setTarget("CameraOne") |
---|
| 34 | triggerTwo:setRadius(5) |
---|
[4603] | 35 | --triggerTwo:setDebugDraw(true) |
---|
[4561] | 36 | |
---|
| 37 | -- Cameraswitchthree |
---|
| 38 | triggerThree = ScriptTrigger() |
---|
| 39 | triggerThree:setScript("cutscene.lua") |
---|
| 40 | triggerThree:setFunction("switchCamToStation") |
---|
[4593] | 41 | triggerThree:setAbsCoor(-125, 0 , -25) |
---|
[4563] | 42 | triggerThree:setTarget("CameraOne") |
---|
| 43 | triggerThree:setRadius(5) |
---|
[4603] | 44 | --triggerThree:setDebugDraw(true) |
---|
[4561] | 45 | |
---|
[4555] | 46 | |
---|
| 47 | -- Get objects from orxonox |
---|
| 48 | thisscript:addObject("CameraMan", "cameraManager") |
---|
[4597] | 49 | thisscript:addObject("NPC", "fighterThree") |
---|
[4569] | 50 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
[4605] | 51 | thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen") |
---|
[4555] | 52 | |
---|
[4569] | 53 | |
---|
[4561] | 54 | -- Global Variables |
---|
[4555] | 55 | time = 0 |
---|
[4570] | 56 | stationReached = false |
---|
| 57 | fadeout = false |
---|
[4568] | 58 | bInit = 0 |
---|
| 59 | bInit2 = 0 |
---|
[4555] | 60 | |
---|
[4561] | 61 | |
---|
| 62 | -- Switch cam functions |
---|
| 63 | function switchCamTargetToEarth(timestep) |
---|
| 64 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
| 65 | return true |
---|
| 66 | end |
---|
| 67 | |
---|
| 68 | function switchCamToSpaceship(timestep) |
---|
| 69 | cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne") |
---|
| 70 | return true |
---|
| 71 | end |
---|
| 72 | |
---|
| 73 | function switchCamToStation(timestep) |
---|
| 74 | cameraManager:atachCurrCameraToWorldEntity("Building", "zhara") |
---|
[4570] | 75 | stationReached = true |
---|
| 76 | time = 0 |
---|
[4563] | 77 | --cameraManager:detachCurrCamera() |
---|
[4561] | 78 | return true |
---|
| 79 | end |
---|
| 80 | |
---|
[4582] | 81 | function switchCamToBomber(timestep) |
---|
| 82 | cameraManager:changeCurrTarget( "NPC", "fighterTwo") |
---|
| 83 | return true |
---|
| 84 | end |
---|
[4561] | 85 | |
---|
[4582] | 86 | |
---|
| 87 | |
---|
[4555] | 88 | -- THE tick function |
---|
| 89 | |
---|
| 90 | function tick(timestep) |
---|
| 91 | time = time + timestep |
---|
[4563] | 92 | |
---|
[4570] | 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 | |
---|
[4605] | 105 | if time > 2.5 then |
---|
| 106 | scrollingScreen:start() |
---|
| 107 | end |
---|
| 108 | |
---|
[4597] | 109 | if time > 3 and time < 4 then |
---|
[4605] | 110 | fighterThree:fire() |
---|
[4597] | 111 | end |
---|
| 112 | |
---|
[4563] | 113 | if not cameraSwitched then |
---|
[4561] | 114 | cameraManager:setCam("CameraOne") |
---|
[4582] | 115 | cameraManager:jumpCurrCam(125,0,-245) |
---|
| 116 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "pirateOne") |
---|
[4574] | 117 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
[4555] | 118 | cameraSwitched = true |
---|
[4563] | 119 | end |
---|
[4555] | 120 | |
---|
[4570] | 121 | if time > 4 and stationReached and not fadeout then |
---|
| 122 | cameraManager:toggleFade() |
---|
| 123 | fadeout = true |
---|
[4555] | 124 | end |
---|
| 125 | |
---|
[4570] | 126 | if time > 6 and stationReached then |
---|
| 127 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
| 128 | gameWorld:stop() |
---|
| 129 | return true |
---|
| 130 | end |
---|
| 131 | |
---|
[4555] | 132 | return false |
---|
| 133 | end |
---|