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 | -- Cameraswitchone |
---|
8 | triggerOne = ScriptTrigger() |
---|
9 | triggerOne:setScript("cutscene.lua") |
---|
10 | triggerOne:setFunction("switchCamTargetToEarth") |
---|
11 | triggerOne:setAbsCoor(0 , 0 , 0) |
---|
12 | triggerOne:setTarget("CameraOne") |
---|
13 | triggerOne:setRadius(10) |
---|
14 | triggerOne:setDebugDraw(true) |
---|
15 | |
---|
16 | |
---|
17 | -- Cameraswitchtwo |
---|
18 | triggerTwo = ScriptTrigger() |
---|
19 | triggerTwo:setScript("cutscene.lua") |
---|
20 | triggerTwo:setFunction("switchCamToSpaceship") |
---|
21 | triggerTwo:setAbsCoor(0, 0 , 150) |
---|
22 | triggerTwo:setTarget("CameraOne") |
---|
23 | triggerTwo:setRadius(5) |
---|
24 | triggerTwo:setDebugDraw(true) |
---|
25 | |
---|
26 | -- Cameraswitchthree |
---|
27 | triggerThree = ScriptTrigger() |
---|
28 | triggerThree:setScript("cutscene.lua") |
---|
29 | triggerThree:setFunction("switchCamToStation") |
---|
30 | triggerThree:setAbsCoor(-125, 0 , 175) |
---|
31 | triggerThree:setTarget("CameraOne") |
---|
32 | triggerThree:setRadius(5) |
---|
33 | triggerThree:setDebugDraw(true) |
---|
34 | |
---|
35 | |
---|
36 | -- Get objects from orxonox |
---|
37 | thisscript:addObject("CameraMan", "cameraManager") |
---|
38 | thisscript:addObject("NPC", "shutleOne") |
---|
39 | thisscript:addObjectAsName("GameWorld", "Cut Scene", "gameWorld") |
---|
40 | |
---|
41 | |
---|
42 | -- Global Variables |
---|
43 | time = 0 |
---|
44 | stationReached = false |
---|
45 | fadeout = false |
---|
46 | bInit = 0 |
---|
47 | bInit2 = 0 |
---|
48 | |
---|
49 | |
---|
50 | -- shutleOne |
---|
51 | shutle = { } |
---|
52 | --{ |
---|
53 | |
---|
54 | function shutle:tick(timestep) |
---|
55 | |
---|
56 | if cameraManager:getCurrCameraCoorZ() > 0 then |
---|
57 | coorX = shutleOne:getAbsCoorX() |
---|
58 | coorY = shutleOne:getAbsCoorY() |
---|
59 | coorZ = shutleOne:getAbsCoorZ() |
---|
60 | shutleOne:setAbsCoor(coorX-6*timestep,coorY,coorZ) |
---|
61 | end |
---|
62 | end |
---|
63 | |
---|
64 | --} |
---|
65 | |
---|
66 | |
---|
67 | -- Switch cam functions |
---|
68 | function switchCamTargetToEarth(timestep) |
---|
69 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
70 | return true |
---|
71 | end |
---|
72 | |
---|
73 | function switchCamToSpaceship(timestep) |
---|
74 | cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne") |
---|
75 | return true |
---|
76 | end |
---|
77 | |
---|
78 | function switchCamToStation(timestep) |
---|
79 | cameraManager:atachCurrCameraToWorldEntity("Building", "zhara") |
---|
80 | stationReached = true |
---|
81 | time = 0 |
---|
82 | --cameraManager:detachCurrCamera() |
---|
83 | return true |
---|
84 | end |
---|
85 | |
---|
86 | |
---|
87 | -- THE tick function |
---|
88 | |
---|
89 | function tick(timestep) |
---|
90 | time = time + timestep |
---|
91 | |
---|
92 | shutle:tick(timestep) |
---|
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 | if not cameraSwitched then |
---|
106 | cameraManager:setCam("CameraOne") |
---|
107 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "bomberOne") |
---|
108 | cameraManager:changeCurrTarget("Building", "zhara") |
---|
109 | cameraSwitched = true |
---|
110 | end |
---|
111 | |
---|
112 | if time > 4 and stationReached and not fadeout then |
---|
113 | cameraManager:toggleFade() |
---|
114 | fadeout = true |
---|
115 | end |
---|
116 | |
---|
117 | if time > 6 and stationReached then |
---|
118 | gameWorld:setNextStoryName( "Space Station 1" ) |
---|
119 | gameWorld:stop() |
---|
120 | return true |
---|
121 | end |
---|
122 | |
---|
123 | return false |
---|
124 | end |
---|