Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/cutscene/cutscene.lua @ 5485

Last change on this file since 5485 was 4765, checked in by snellen, 18 years ago

adapted all the scripts to the new trunk

File size: 5.2 KB
RevLine 
[4561]1-- Main trigger
[4765]2trigger = TickTrigger()                     -- Create the trigger
[4555]3trigger:setScript("cutscene.lua")             -- Tell the trigger which script to call
4trigger:setFunction("tick")                   -- Tell the trigger which scriptfunction to call
[4765]5 
[4561]6
[4582]7
8-- Cameraswitchzero
[4765]9triggerZero = SpaceTrigger()
[4582]10triggerZero:setScript("cutscene.lua")
11triggerZero:setFunction("switchCamToBomber")
12triggerZero:setAbsCoor(37 , 0 , -200)
13triggerZero:setTarget("CameraOne")
14triggerZero:setRadius(10)
[4603]15--triggerZero:setDebugDraw(true)
[4582]16
17
[4561]18-- Cameraswitchone
[4765]19triggerOne = SpaceTrigger()
[4561]20triggerOne:setScript("cutscene.lua")
21triggerOne:setFunction("switchCamTargetToEarth")
[4587]22triggerOne:setAbsCoor(5 , 0 , -140)
[4561]23triggerOne:setTarget("CameraOne")
[4563]24triggerOne:setRadius(10)
[4603]25--triggerOne:setDebugDraw(true)
[4561]26
27
28-- Cameraswitchtwo
[4765]29triggerTwo = SpaceTrigger()
[4561]30triggerTwo:setScript("cutscene.lua")
31triggerTwo:setFunction("switchCamToSpaceship")
[4593]32triggerTwo:setAbsCoor(0, 0 , -25)
[4563]33triggerTwo:setTarget("CameraOne")
34triggerTwo:setRadius(5)
[4603]35--triggerTwo:setDebugDraw(true) 
[4561]36
37-- Cameraswitchthree
[4765]38triggerThree = SpaceTrigger()
[4561]39triggerThree:setScript("cutscene.lua")
40triggerThree:setFunction("switchCamToStation")
[4593]41triggerThree:setAbsCoor(-125, 0 , -25)
[4563]42triggerThree:setTarget("CameraOne")
43triggerThree:setRadius(5)
[4603]44--triggerThree:setDebugDraw(true) 
[4561]45
[4655]46
47-- startScenery
[4765]48triggerFour = SpaceTrigger()
[4655]49triggerFour:setScript("cutscene.lua")
50triggerFour:setFunction("startSceneryOne")
51triggerFour:setAbsCoor(125,0,-245)
52triggerFour:setTarget("CameraOne")
53triggerFour:setRadius(5)
[4659]54--triggerFour:setDebugDraw(true) 
[4655]55
[4765]56-- Scroller
57triggerScr = TimeTrigger()                 
58triggerScr:setScript("cutscene.lua")             
59triggerScr:setFunction("startScrolling")
60triggerScr:setDelay(10)
[4655]61
[4765]62
[4555]63-- Get objects from orxonox
64thisscript:addObject("CameraMan", "cameraManager")
[4655]65thisscript:addObject("NPC", "shutleOne")
66thisscript:addObject("NPC", "bomberOne")
67thisscript:addObject("NPC", "fighterOne")
68thisscript:addObject("NPC", "bomberTwo")
69thisscript:addObject("NPC", "fighterTwo")
70thisscript:addObject("NPC", "pirateOne")
71thisscript:addObject("NPC", "pirateTwo")
[4597]72thisscript:addObject("NPC", "fighterThree")
[4655]73thisscript:addObject("NPC", "bomberThree")
74thisscript:addObject("NPC", "bomberFour")
[4569]75thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld")
[4605]76thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen")
[4555]77
[4569]78
[4561]79-- Global Variables
[4555]80time = 0
[4570]81fadeout = false
[4568]82bInit = 0
83bInit2 = 0
[4655]84sceneryOneStopped = false
85sceneryOneRunning = false
86stationReached = false
[4555]87
[4561]88-- Switch cam functions
89function switchCamTargetToEarth(timestep)
90cameraManager:changeCurrTarget("Planet", "Earth")
91return true
92end
93
94function switchCamToSpaceship(timestep)
[4760]95cameraManager:attachCurrCamera( "NPC", "shutleOne")
[4561]96return true
97end
98
99function switchCamToStation(timestep)
[4760]100cameraManager:attachCurrCamera("Building", "zhara")
[4570]101stationReached = true
102time = 0
[4563]103--cameraManager:detachCurrCamera()
[4561]104return true
105end
106
[4582]107function switchCamToBomber(timestep)
108cameraManager:changeCurrTarget( "NPC", "fighterTwo")
109return true
110end
[4561]111
[4655]112-- Start
113function startSceneryOne(timestep)
[4582]114
[4655]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
125shutleOne:pause(false)
126bomberOne:pause(false)
127fighterOne:pause(false)
128bomberTwo:pause(false)
129fighterTwo:pause(false)
130pirateOne:pause(false)
131pirateTwo:pause(false)
132fighterThree:pause(false)
133bomberThree:pause(false)
134bomberFour:pause(false)
135
136sceneryOneRunning = true
137time = 0
138
139return true
140
141end
142
143-- Stop
144function 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
156shutleOne:pause(true)
157bomberOne:pause(true)
158fighterOne:pause(true)
159bomberTwo:pause(true)
160fighterTwo:pause(true)
161pirateOne:pause(true)
162pirateTwo:pause(true)
163fighterThree:pause(true)
164bomberThree:pause(true)
[4765]165bomberFour:pause(true)
[4655]166
167return true
168
169end
170
[4765]171-- Start the scrolling screen
172function startScrolling(timestep)
173scrollingScreen:start()
174return true
175end
[4655]176
[4555]177-- THE tick function
178
179function tick(timestep)
180time = time + timestep
[4765]181triggerScr:start()
[4563]182
[4655]183if not sceneryOneStopped then
184sceneryOneStopped = stopSceneryOne(timestep)
185end
[4570]186
[4568]187if bInit == 0 then
188  cameraManager:initFadeBlack()
[4570]189  gameWorld:showText("Earth Solar System");
[4568]190  bInit = 1
191end
192
[4570]193if time > 2 and bInit2 == 0 then
[4568]194   cameraManager:toggleFade()
195   bInit2 = 1
196end
197
[4605]198
[4606]199
[4655]200if time > 8 and time < 8.5 and sceneryOneRunning then
[4605]201   fighterThree:fire()
[4597]202end
203
[4563]204if not cameraSwitched then
[4561]205cameraManager:setCam("CameraOne")
[4582]206cameraManager:jumpCurrCam(125,0,-245)
[4760]207--cameraManager:attachCurrCamera("NPC", "transporterOne")
[4671]208cameraManager:changeCurrTarget("Building", "zhara")
[4555]209cameraSwitched = true
[4563]210end
[4555]211
[4570]212if time > 4  and stationReached and not fadeout then
213cameraManager:toggleFade()
214fadeout = true
[4555]215end
216
[4570]217if time > 6 and stationReached then
218gameWorld:setNextStoryName( "Space Station 1" ) 
219gameWorld:stop()
220return true
221end
222
[4555]223return false
224end 
Note: See TracBrowser for help on using the repository browser.