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 | -- Get objects from orxonox |
---|
48 | thisscript:addObject("CameraMan", "cameraManager") |
---|
49 | thisscript:addObject("NPC", "fighterThree") |
---|
50 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
51 | thisscript:addObjectAsName("ScrollingScreen", "Credits Scroller","scrollingScreen") |
---|
52 | |
---|
53 | |
---|
54 | -- Global Variables |
---|
55 | time = 0 |
---|
56 | stationReached = false |
---|
57 | fadeout = false |
---|
58 | bInit = 0 |
---|
59 | bInit2 = 0 |
---|
60 | |
---|
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") |
---|
75 | stationReached = true |
---|
76 | time = 0 |
---|
77 | --cameraManager:detachCurrCamera() |
---|
78 | return true |
---|
79 | end |
---|
80 | |
---|
81 | function switchCamToBomber(timestep) |
---|
82 | cameraManager:changeCurrTarget( "NPC", "fighterTwo") |
---|
83 | return true |
---|
84 | end |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | -- THE tick function |
---|
89 | |
---|
90 | function tick(timestep) |
---|
91 | time = time + timestep |
---|
92 | |
---|
93 | |
---|
94 | if bInit == 0 then |
---|
95 | cameraManager:initFadeBlack() |
---|
96 | gameWorld:showText("Earth Solar System"); |
---|
97 | bInit = 1 |
---|
98 | end |
---|
99 | |
---|
100 | if time > 2 and bInit2 == 0 then |
---|
101 | cameraManager:toggleFade() |
---|
102 | bInit2 = 1 |
---|
103 | end |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | if time > 3 and time < 4 then |
---|
108 | fighterThree:fire() |
---|
109 | end |
---|
110 | |
---|
111 | if not cameraSwitched then |
---|
112 | cameraManager:setCam("CameraOne") |
---|
113 | cameraManager:jumpCurrCam(125,0,-245) |
---|
114 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "pirateOne") |
---|
115 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
116 | cameraSwitched = true |
---|
117 | end |
---|
118 | |
---|
119 | if time > 4 and stationReached and not fadeout then |
---|
120 | cameraManager:toggleFade() |
---|
121 | fadeout = true |
---|
122 | end |
---|
123 | |
---|
124 | if time > 10 then |
---|
125 | scrollingScreen:start() |
---|
126 | end |
---|
127 | |
---|
128 | |
---|
129 | if time > 6 and stationReached then |
---|
130 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
131 | gameWorld:stop() |
---|
132 | return true |
---|
133 | end |
---|
134 | |
---|
135 | return false |
---|
136 | end |
---|