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 | |
---|
52 | |
---|
53 | -- Global Variables |
---|
54 | time = 0 |
---|
55 | stationReached = false |
---|
56 | fadeout = false |
---|
57 | bInit = 0 |
---|
58 | bInit2 = 0 |
---|
59 | |
---|
60 | |
---|
61 | -- Switch cam functions |
---|
62 | function switchCamTargetToEarth(timestep) |
---|
63 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
64 | return true |
---|
65 | end |
---|
66 | |
---|
67 | function switchCamToSpaceship(timestep) |
---|
68 | cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne") |
---|
69 | return true |
---|
70 | end |
---|
71 | |
---|
72 | function switchCamToStation(timestep) |
---|
73 | cameraManager:atachCurrCameraToWorldEntity("Building", "zhara") |
---|
74 | stationReached = true |
---|
75 | time = 0 |
---|
76 | --cameraManager:detachCurrCamera() |
---|
77 | return true |
---|
78 | end |
---|
79 | |
---|
80 | function switchCamToBomber(timestep) |
---|
81 | cameraManager:changeCurrTarget( "NPC", "fighterTwo") |
---|
82 | return true |
---|
83 | end |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | -- THE tick function |
---|
88 | |
---|
89 | function tick(timestep) |
---|
90 | time = time + timestep |
---|
91 | |
---|
92 | |
---|
93 | if bInit == 0 then |
---|
94 | cameraManager:initFadeBlack() |
---|
95 | gameWorld:showText("Earth Solar System"); |
---|
96 | bInit = 1 |
---|
97 | end |
---|
98 | |
---|
99 | if time > 2 and bInit2 == 0 then |
---|
100 | cameraManager:toggleFade() |
---|
101 | bInit2 = 1 |
---|
102 | end |
---|
103 | |
---|
104 | if time > 3 and time < 4 then |
---|
105 | fighterThree:fire() |
---|
106 | end |
---|
107 | |
---|
108 | if not cameraSwitched then |
---|
109 | cameraManager:setCam("CameraOne") |
---|
110 | cameraManager:jumpCurrCam(125,0,-245) |
---|
111 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "pirateOne") |
---|
112 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
113 | cameraSwitched = true |
---|
114 | end |
---|
115 | |
---|
116 | if time > 4 and stationReached and not fadeout then |
---|
117 | cameraManager:toggleFade() |
---|
118 | fadeout = true |
---|
119 | end |
---|
120 | |
---|
121 | if time > 6 and stationReached then |
---|
122 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
123 | gameWorld:stop() |
---|
124 | return true |
---|
125 | end |
---|
126 | |
---|
127 | return false |
---|
128 | end |
---|