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 , -50) |
---|
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 , 125) |
---|
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 | bInit = 0 |
---|
45 | bInit2 = 0 |
---|
46 | |
---|
47 | |
---|
48 | -- shutleOne |
---|
49 | shutle = { } |
---|
50 | --{ |
---|
51 | |
---|
52 | function shutle:tick(timestep) |
---|
53 | if cameraManager:getCurrCameraCoorZ() > 0 then |
---|
54 | coorX = shutleOne:getAbsCoorX() |
---|
55 | coorY = shutleOne:getAbsCoorY() |
---|
56 | coorZ = shutleOne:getAbsCoorZ() |
---|
57 | shutleOne:setAbsCoor(coorX-.06,coorY,coorZ) |
---|
58 | end |
---|
59 | end |
---|
60 | |
---|
61 | --} |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | -- Switch cam functions |
---|
66 | function switchCamTargetToEarth(timestep) |
---|
67 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
68 | return true |
---|
69 | end |
---|
70 | |
---|
71 | function switchCamToSpaceship(timestep) |
---|
72 | cameraManager:atachCurrCameraToWorldEntity( "NPC", "shutleOne") |
---|
73 | return true |
---|
74 | end |
---|
75 | |
---|
76 | function switchCamToStation(timestep) |
---|
77 | cameraManager:atachCurrCameraToWorldEntity("Building", "zhara") |
---|
78 | |
---|
79 | --cameraManager:detachCurrCamera() |
---|
80 | return true |
---|
81 | end |
---|
82 | |
---|
83 | |
---|
84 | -- THE tick function |
---|
85 | |
---|
86 | function tick(timestep) |
---|
87 | time = time + timestep |
---|
88 | |
---|
89 | if bInit == 0 then |
---|
90 | cameraManager:initFadeBlack() |
---|
91 | bInit = 1 |
---|
92 | end |
---|
93 | |
---|
94 | if time > 1 and bInit2 == 0 then |
---|
95 | cameraManager:toggleFade() |
---|
96 | gameWorld:showText("Earth Solar System"); |
---|
97 | bInit2 = 1 |
---|
98 | end |
---|
99 | |
---|
100 | shutle:tick(timestep) |
---|
101 | |
---|
102 | if not cameraSwitched then |
---|
103 | cameraManager:setCam("CameraOne") |
---|
104 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "shutleOne") |
---|
105 | cameraManager:changeCurrTarget("Planet", "Moon") |
---|
106 | cameraSwitched = true |
---|
107 | end |
---|
108 | |
---|
109 | if time > 4 then |
---|
110 | --cameraManager:toggleFade() |
---|
111 | --return true |
---|
112 | end |
---|
113 | |
---|
114 | return false |
---|
115 | end |
---|