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 | |
---|
40 | -- Global Variables |
---|
41 | time = 0 |
---|
42 | |
---|
43 | |
---|
44 | -- shutleOne |
---|
45 | shutle = { } |
---|
46 | --{ |
---|
47 | |
---|
48 | function shutle:tick(timestep) |
---|
49 | if cameraManager:getCurrCameraCoorZ() > 0 then |
---|
50 | coorX = shutleOne:getAbsCoorX() |
---|
51 | coorY = shutleOne:getAbsCoorY() |
---|
52 | coorZ = shutleOne:getAbsCoorZ() |
---|
53 | shutleOne:setAbsCoor(coorX-.06,coorY,coorZ) |
---|
54 | end |
---|
55 | end |
---|
56 | |
---|
57 | --} |
---|
58 | |
---|
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 | |
---|
75 | --cameraManager:detachCurrCamera() |
---|
76 | return true |
---|
77 | end |
---|
78 | |
---|
79 | |
---|
80 | -- THE tick function |
---|
81 | |
---|
82 | function tick(timestep) |
---|
83 | time = time + timestep |
---|
84 | |
---|
85 | shutle:tick(timestep) |
---|
86 | |
---|
87 | if not cameraSwitched then |
---|
88 | cameraManager:setCam("CameraOne") |
---|
89 | --cameraManager:atachCurrCameraToWorldEntity("NPC", "shutleOne") |
---|
90 | cameraManager:changeCurrTarget("Planet", "Moon") |
---|
91 | cameraSwitched = true |
---|
92 | end |
---|
93 | |
---|
94 | if time > 4 then |
---|
95 | --cameraManager:togglFade() |
---|
96 | --return true |
---|
97 | end |
---|
98 | |
---|
99 | return false |
---|
100 | end |
---|