1 | -- Main trigger |
---|
2 | trigger = TickTrigger() -- 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 | |
---|
6 | |
---|
7 | |
---|
8 | -- Cameraswitchzero |
---|
9 | triggerZero = SpaceTrigger() |
---|
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 = SpaceTrigger() |
---|
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 = SpaceTrigger() |
---|
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 = SpaceTrigger() |
---|
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 = SpaceTrigger() |
---|
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 | -- Scroller |
---|
57 | triggerScr = TimeTrigger() |
---|
58 | triggerScr:setScript("cutscene.lua") |
---|
59 | triggerScr:setFunction("startScrolling") |
---|
60 | triggerScr:setDelay(10) |
---|
61 | |
---|
62 | |
---|
63 | -- Get objects from orxonox |
---|
64 | thisscript:addObject("CameraMan", "cameraManager") |
---|
65 | thisscript:addObject("NPC", "shutleOne") |
---|
66 | thisscript:addObject("NPC", "bomberOne") |
---|
67 | thisscript:addObject("NPC", "fighterOne") |
---|
68 | thisscript:addObject("NPC", "bomberTwo") |
---|
69 | thisscript:addObject("NPC", "fighterTwo") |
---|
70 | thisscript:addObject("NPC", "pirateOne") |
---|
71 | thisscript:addObject("NPC", "pirateTwo") |
---|
72 | thisscript:addObject("NPC", "fighterThree") |
---|
73 | thisscript:addObject("NPC", "bomberThree") |
---|
74 | thisscript:addObject("NPC", "bomberFour") |
---|
75 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
76 | thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen") |
---|
77 | |
---|
78 | |
---|
79 | -- Global Variables |
---|
80 | time = 0 |
---|
81 | fadeout = false |
---|
82 | bInit = 0 |
---|
83 | bInit2 = 0 |
---|
84 | sceneryOneStopped = false |
---|
85 | sceneryOneRunning = false |
---|
86 | stationReached = false |
---|
87 | |
---|
88 | -- Switch cam functions |
---|
89 | function switchCamTargetToEarth(timestep) |
---|
90 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
91 | return true |
---|
92 | end |
---|
93 | |
---|
94 | function switchCamToSpaceship(timestep) |
---|
95 | cameraManager:attachCurrCamera( "NPC", "shutleOne") |
---|
96 | return true |
---|
97 | end |
---|
98 | |
---|
99 | function switchCamToStation(timestep) |
---|
100 | cameraManager:attachCurrCamera("Building", "zhara") |
---|
101 | stationReached = true |
---|
102 | time = 0 |
---|
103 | --cameraManager:detachCurrCamera() |
---|
104 | return true |
---|
105 | end |
---|
106 | |
---|
107 | function switchCamToBomber(timestep) |
---|
108 | cameraManager:changeCurrTarget( "NPC", "fighterTwo") |
---|
109 | return true |
---|
110 | end |
---|
111 | |
---|
112 | -- Start |
---|
113 | function startSceneryOne(timestep) |
---|
114 | |
---|
115 | --shutleOne:unhide() |
---|
116 | --bomberOne:unhide() |
---|
117 | --fighterOne:unhide() |
---|
118 | --bomberTwo:unhide() |
---|
119 | --fighterTwo:unhide() |
---|
120 | --pirateOne:unhide()) |
---|
121 | --pirateTwo:unhide() |
---|
122 | --fighterThree:unhide() |
---|
123 | --bomberThree:unhide() |
---|
124 | |
---|
125 | shutleOne:pause(false) |
---|
126 | bomberOne:pause(false) |
---|
127 | fighterOne:pause(false) |
---|
128 | bomberTwo:pause(false) |
---|
129 | fighterTwo:pause(false) |
---|
130 | pirateOne:pause(false) |
---|
131 | pirateTwo:pause(false) |
---|
132 | fighterThree:pause(false) |
---|
133 | bomberThree:pause(false) |
---|
134 | bomberFour:pause(false) |
---|
135 | |
---|
136 | sceneryOneRunning = true |
---|
137 | time = 0 |
---|
138 | |
---|
139 | return true |
---|
140 | |
---|
141 | end |
---|
142 | |
---|
143 | -- Stop |
---|
144 | function stopSceneryOne(timestep) |
---|
145 | |
---|
146 | --shutleOne:hide() |
---|
147 | --bomberOne:hide() |
---|
148 | --fighterOne:hide() |
---|
149 | --bomberTwo:hide() |
---|
150 | --fighterTwo:hide() |
---|
151 | --pirateOne:hide()) |
---|
152 | --pirateTwo:hide() |
---|
153 | --fighterThree:hide() |
---|
154 | --bomberThree:hide() |
---|
155 | |
---|
156 | shutleOne:pause(true) |
---|
157 | bomberOne:pause(true) |
---|
158 | fighterOne:pause(true) |
---|
159 | bomberTwo:pause(true) |
---|
160 | fighterTwo:pause(true) |
---|
161 | pirateOne:pause(true) |
---|
162 | pirateTwo:pause(true) |
---|
163 | fighterThree:pause(true) |
---|
164 | bomberThree:pause(true) |
---|
165 | bomberFour:pause(true) |
---|
166 | |
---|
167 | return true |
---|
168 | |
---|
169 | end |
---|
170 | |
---|
171 | -- Start the scrolling screen |
---|
172 | function startScrolling(timestep) |
---|
173 | scrollingScreen:start() |
---|
174 | return true |
---|
175 | end |
---|
176 | |
---|
177 | -- THE tick function |
---|
178 | |
---|
179 | function tick(timestep) |
---|
180 | time = time + timestep |
---|
181 | triggerScr:start() |
---|
182 | |
---|
183 | if not sceneryOneStopped then |
---|
184 | sceneryOneStopped = stopSceneryOne(timestep) |
---|
185 | end |
---|
186 | |
---|
187 | if bInit == 0 then |
---|
188 | cameraManager:initFadeBlack() |
---|
189 | gameWorld:showText("Earth Solar System"); |
---|
190 | bInit = 1 |
---|
191 | end |
---|
192 | |
---|
193 | if time > 2 and bInit2 == 0 then |
---|
194 | cameraManager:toggleFade() |
---|
195 | bInit2 = 1 |
---|
196 | end |
---|
197 | |
---|
198 | |
---|
199 | |
---|
200 | if time > 8 and time < 8.5 and sceneryOneRunning then |
---|
201 | fighterThree:fire() |
---|
202 | end |
---|
203 | |
---|
204 | if not cameraSwitched then |
---|
205 | cameraManager:setCam("CameraOne") |
---|
206 | cameraManager:jumpCurrCam(125,0,-245) |
---|
207 | --cameraManager:attachCurrCamera("NPC", "transporterOne") |
---|
208 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
209 | cameraSwitched = true |
---|
210 | end |
---|
211 | |
---|
212 | if time > 4 and stationReached and not fadeout then |
---|
213 | cameraManager:toggleFade() |
---|
214 | fadeout = true |
---|
215 | end |
---|
216 | |
---|
217 | if time > 6 and stationReached then |
---|
218 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
219 | gameWorld:stop() |
---|
220 | return true |
---|
221 | end |
---|
222 | |
---|
223 | return false |
---|
224 | end |
---|