1 | -- Main trigger |
---|
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 |
---|
5 | trigger:setActiveOnCreation(true) |
---|
6 | |
---|
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 | |
---|
18 | -- Cameraswitchone |
---|
19 | triggerOne = ScriptTrigger() |
---|
20 | triggerOne:setScript("cutscene.lua") |
---|
21 | triggerOne:setFunction("switchCamTargetToEarth") |
---|
22 | triggerOne:setAbsCoor(5 , 0 , -140) |
---|
23 | triggerOne:setTarget("CameraOne") |
---|
24 | triggerOne:setRadius(10) |
---|
25 | --triggerOne:setDebugDraw(true) |
---|
26 | |
---|
27 | |
---|
28 | -- Cameraswitchtwo |
---|
29 | triggerTwo = ScriptTrigger() |
---|
30 | triggerTwo:setScript("cutscene.lua") |
---|
31 | triggerTwo:setFunction("switchCamToSpaceship") |
---|
32 | triggerTwo:setAbsCoor(0, 0 , -25) |
---|
33 | triggerTwo:setTarget("CameraOne") |
---|
34 | triggerTwo:setRadius(5) |
---|
35 | --triggerTwo:setDebugDraw(true) |
---|
36 | |
---|
37 | -- Cameraswitchthree |
---|
38 | triggerThree = ScriptTrigger() |
---|
39 | triggerThree:setScript("cutscene.lua") |
---|
40 | triggerThree:setFunction("switchCamToStation") |
---|
41 | triggerThree:setAbsCoor(-125, 0 , -25) |
---|
42 | triggerThree:setTarget("CameraOne") |
---|
43 | triggerThree:setRadius(5) |
---|
44 | --triggerThree:setDebugDraw(true) |
---|
45 | |
---|
46 | |
---|
47 | -- startScenery |
---|
48 | triggerFour = ScriptTrigger() |
---|
49 | triggerFour:setScript("cutscene.lua") |
---|
50 | triggerFour:setFunction("startSceneryOne") |
---|
51 | triggerFour:setAbsCoor(125,0,-245) |
---|
52 | triggerFour:setTarget("CameraOne") |
---|
53 | triggerFour:setRadius(5) |
---|
54 | --triggerFour:setDebugDraw(true) |
---|
55 | |
---|
56 | |
---|
57 | -- Get objects from orxonox |
---|
58 | thisscript:addObject("CameraMan", "cameraManager") |
---|
59 | thisscript:addObject("NPC", "shutleOne") |
---|
60 | thisscript:addObject("NPC", "bomberOne") |
---|
61 | thisscript:addObject("NPC", "fighterOne") |
---|
62 | thisscript:addObject("NPC", "bomberTwo") |
---|
63 | thisscript:addObject("NPC", "fighterTwo") |
---|
64 | thisscript:addObject("NPC", "pirateOne") |
---|
65 | thisscript:addObject("NPC", "pirateTwo") |
---|
66 | thisscript:addObject("NPC", "fighterThree") |
---|
67 | thisscript:addObject("NPC", "bomberThree") |
---|
68 | thisscript:addObject("NPC", "bomberFour") |
---|
69 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
70 | thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen") |
---|
71 | |
---|
72 | |
---|
73 | -- Global Variables |
---|
74 | time = 0 |
---|
75 | fadeout = false |
---|
76 | bInit = 0 |
---|
77 | bInit2 = 0 |
---|
78 | sceneryOneStopped = false |
---|
79 | sceneryOneRunning = false |
---|
80 | stationReached = false |
---|
81 | |
---|
82 | -- Switch cam functions |
---|
83 | function switchCamTargetToEarth(timestep) |
---|
84 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
85 | return true |
---|
86 | end |
---|
87 | |
---|
88 | function switchCamToSpaceship(timestep) |
---|
89 | cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne") |
---|
90 | return true |
---|
91 | end |
---|
92 | |
---|
93 | function switchCamToStation(timestep) |
---|
94 | cameraManager:atachCurrCameraToWorldEntity("Building", "zhara") |
---|
95 | stationReached = true |
---|
96 | time = 0 |
---|
97 | --cameraManager:detachCurrCamera() |
---|
98 | return true |
---|
99 | end |
---|
100 | |
---|
101 | function switchCamToBomber(timestep) |
---|
102 | cameraManager:changeCurrTarget( "NPC", "fighterTwo") |
---|
103 | return true |
---|
104 | end |
---|
105 | |
---|
106 | |
---|
107 | -- Start |
---|
108 | function startSceneryOne(timestep) |
---|
109 | |
---|
110 | --shutleOne:unhide() |
---|
111 | --bomberOne:unhide() |
---|
112 | --fighterOne:unhide() |
---|
113 | --bomberTwo:unhide() |
---|
114 | --fighterTwo:unhide() |
---|
115 | --pirateOne:unhide()) |
---|
116 | --pirateTwo:unhide() |
---|
117 | --fighterThree:unhide() |
---|
118 | --bomberThree:unhide() |
---|
119 | |
---|
120 | shutleOne:pause(false) |
---|
121 | bomberOne:pause(false) |
---|
122 | fighterOne:pause(false) |
---|
123 | bomberTwo:pause(false) |
---|
124 | fighterTwo:pause(false) |
---|
125 | pirateOne:pause(false) |
---|
126 | pirateTwo:pause(false) |
---|
127 | fighterThree:pause(false) |
---|
128 | bomberThree:pause(false) |
---|
129 | bomberFour:pause(false) |
---|
130 | |
---|
131 | sceneryOneRunning = true |
---|
132 | time = 0 |
---|
133 | |
---|
134 | return true |
---|
135 | |
---|
136 | end |
---|
137 | |
---|
138 | -- Stop |
---|
139 | function stopSceneryOne(timestep) |
---|
140 | |
---|
141 | --shutleOne:hide() |
---|
142 | --bomberOne:hide() |
---|
143 | --fighterOne:hide() |
---|
144 | --bomberTwo:hide() |
---|
145 | --fighterTwo:hide() |
---|
146 | --pirateOne:hide()) |
---|
147 | --pirateTwo:hide() |
---|
148 | --fighterThree:hide() |
---|
149 | --bomberThree:hide() |
---|
150 | |
---|
151 | shutleOne:pause(true) |
---|
152 | bomberOne:pause(true) |
---|
153 | fighterOne:pause(true) |
---|
154 | bomberTwo:pause(true) |
---|
155 | fighterTwo:pause(true) |
---|
156 | pirateOne:pause(true) |
---|
157 | pirateTwo:pause(true) |
---|
158 | fighterThree:pause(true) |
---|
159 | bomberThree:pause(true) |
---|
160 | bomberFour:pause(false) |
---|
161 | |
---|
162 | return true |
---|
163 | |
---|
164 | end |
---|
165 | |
---|
166 | |
---|
167 | -- THE tick function |
---|
168 | |
---|
169 | function tick(timestep) |
---|
170 | time = time + timestep |
---|
171 | |
---|
172 | if not sceneryOneStopped then |
---|
173 | sceneryOneStopped = stopSceneryOne(timestep) |
---|
174 | end |
---|
175 | |
---|
176 | if bInit == 0 then |
---|
177 | cameraManager:initFadeBlack() |
---|
178 | gameWorld:showText("Earth Solar System"); |
---|
179 | bInit = 1 |
---|
180 | end |
---|
181 | |
---|
182 | if time > 2 and bInit2 == 0 then |
---|
183 | cameraManager:toggleFade() |
---|
184 | bInit2 = 1 |
---|
185 | end |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | if time > 8 and time < 8.5 and sceneryOneRunning then |
---|
190 | fighterThree:fire() |
---|
191 | end |
---|
192 | |
---|
193 | if not cameraSwitched then |
---|
194 | cameraManager:setCam("CameraOne") |
---|
195 | cameraManager:jumpCurrCam(125,0,-245) |
---|
196 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "transporterOne") |
---|
197 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
198 | cameraSwitched = true |
---|
199 | end |
---|
200 | |
---|
201 | if time > 4 and stationReached and not fadeout then |
---|
202 | cameraManager:toggleFade() |
---|
203 | fadeout = true |
---|
204 | end |
---|
205 | |
---|
206 | if time > 10 then |
---|
207 | scrollingScreen:start() |
---|
208 | end |
---|
209 | |
---|
210 | |
---|
211 | if time > 6 and stationReached then |
---|
212 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
213 | gameWorld:stop() |
---|
214 | return true |
---|
215 | end |
---|
216 | |
---|
217 | return false |
---|
218 | end |
---|