1 | -- Get objects from orxonox |
---|
2 | thisscript:addObject("FPSPlayer", "Player") |
---|
3 | thisscript:addObject("CameraMan", "cameraManager") |
---|
4 | thisscript:addObject("NPC", "IntroSpaceship") |
---|
5 | thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle |
---|
6 | |
---|
7 | thisscript:registerClass("Explosion") |
---|
8 | explosion = Explosion() |
---|
9 | |
---|
10 | -- Initialisation |
---|
11 | triggerInit = TickTrigger() --ScriptTrigger() |
---|
12 | triggerInit:setScript("intro.lua") |
---|
13 | triggerInit:setFunction("startIntro") |
---|
14 | --triggerInit:setActiveOnCreation(true) |
---|
15 | |
---|
16 | -- Camera2MoonstationCenter |
---|
17 | triggerMoonstation = SpaceTrigger() |
---|
18 | triggerMoonstation:setScript("intro.lua") |
---|
19 | triggerMoonstation:setFunction("showMoonstation") |
---|
20 | triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807) |
---|
21 | triggerMoonstation:setTarget("CameraIntro") |
---|
22 | triggerMoonstation:setRadius(150) |
---|
23 | --triggerMoonstation:setDebugDraw(true) |
---|
24 | |
---|
25 | -- Camera2Spaceship |
---|
26 | triggerShowCrash = SpaceTrigger() |
---|
27 | triggerShowCrash:setScript("intro.lua") |
---|
28 | triggerShowCrash:setFunction("showCrashingSpaceship") |
---|
29 | triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926) |
---|
30 | triggerShowCrash:setTarget("CameraIntro") |
---|
31 | triggerShowCrash:setRadius(200) |
---|
32 | --triggerShowCrash:setDebugDraw(true) |
---|
33 | |
---|
34 | -- Explode |
---|
35 | triggerShowCrash = SpaceTrigger() |
---|
36 | triggerShowCrash:setScript("intro.lua") |
---|
37 | triggerShowCrash:setFunction("explodeSpaceship") |
---|
38 | triggerShowCrash:setAbsCoor(840.948486, 175.905289, -175.412460) |
---|
39 | triggerShowCrash:setTarget("IntroSpaceship") |
---|
40 | triggerShowCrash:setRadius(250) |
---|
41 | --triggerShowCrash:setDebugDraw(true) |
---|
42 | |
---|
43 | --hide crashing ship |
---|
44 | triggerShowCrash = SpaceTrigger() |
---|
45 | triggerShowCrash:setScript("intro.lua") |
---|
46 | triggerShowCrash:setFunction("hideCrashingSpaceship") |
---|
47 | triggerShowCrash:setAbsCoor(-100, -400, -110) |
---|
48 | triggerShowCrash:setTarget("IntroSpaceship") |
---|
49 | triggerShowCrash:setRadius(60) |
---|
50 | --triggerShowCrash:setDebugDraw(true) |
---|
51 | |
---|
52 | -- End of Intro |
---|
53 | triggerEndIntro = SpaceTrigger() |
---|
54 | triggerEndIntro:setScript("intro.lua") |
---|
55 | triggerEndIntro:setFunction("stopIntro") |
---|
56 | triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880) |
---|
57 | triggerEndIntro:setTarget("CameraIntro") |
---|
58 | triggerEndIntro:setRadius(110) |
---|
59 | --triggerEndIntro:setDebugDraw(true) |
---|
60 | |
---|
61 | |
---|
62 | -- Functions -------------------------------------------------- |
---|
63 | -- globals |
---|
64 | introRunning = false |
---|
65 | spaceshipCrashDelay = 2 |
---|
66 | boomSize = 100 |
---|
67 | pauseBurn = 0 |
---|
68 | exploded = false |
---|
69 | |
---|
70 | -- init function |
---|
71 | function startIntro(timestep) |
---|
72 | gameWorld:showText("Moon Surface 2102"); |
---|
73 | cameraManager:setCam("CameraIntro") |
---|
74 | cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780) |
---|
75 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
76 | cameraManager:initFadeBlack() |
---|
77 | cameraManager:toggleFade() |
---|
78 | |
---|
79 | IntroSpaceship:pause(true) |
---|
80 | --Player:pause(true) |
---|
81 | introRunning = true |
---|
82 | |
---|
83 | return true --just once |
---|
84 | end |
---|
85 | |
---|
86 | function showMoonstation(timestep) |
---|
87 | cameraManager:changeCurrTarget("Building", "MoonstationCenterHack") |
---|
88 | return true |
---|
89 | end |
---|
90 | |
---|
91 | function showCrashingSpaceship(timestep) |
---|
92 | cameraManager:changeCurrTarget("NPC", "IntroSpaceship") |
---|
93 | spaceshipCrashDelay = spaceshipCrashDelay - timestep |
---|
94 | if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate |
---|
95 | IntroSpaceship:pause(false) |
---|
96 | if pauseBurn==0 then |
---|
97 | pauseBurn = 5 |
---|
98 | explosion:setAbsCoor(IntroSpaceship:getAbsCoorX(),IntroSpaceship:getAbsCoorY(),IntroSpaceship:getAbsCoorZ()) |
---|
99 | explosion:explode(math.random()*50+50, math.random()*50+50, math.random()*50+50) |
---|
100 | if exploded then |
---|
101 | cameraManager:changeCurrTarget("ModelEntity", "destroyed fighter") |
---|
102 | return true |
---|
103 | end |
---|
104 | else |
---|
105 | pauseBurn = pauseBurn - 1 |
---|
106 | end |
---|
107 | return false |
---|
108 | end |
---|
109 | return false |
---|
110 | end |
---|
111 | |
---|
112 | function explodeSpaceship(timestep) |
---|
113 | --gameWorld:showText("BOOOOOOOOOOOOOOOOM"); |
---|
114 | explosion:setAbsCoor(1003, 226, -102) |
---|
115 | explosion:explode(boomSize,boomSize,boomSize) |
---|
116 | boomSize = boomSize + 10 |
---|
117 | if boomSize == 600 then |
---|
118 | return true |
---|
119 | end |
---|
120 | exploded = true |
---|
121 | return false |
---|
122 | end |
---|
123 | |
---|
124 | function hideCrashingSpaceship(timestep) |
---|
125 | IntroSpaceship:pause(true) |
---|
126 | IntroSpaceship:setVisibility(false) |
---|
127 | return true |
---|
128 | end |
---|
129 | |
---|
130 | function stopIntro(timestep) |
---|
131 | cameraManager:setCam("GameWorldCamera") |
---|
132 | --Player:pause(false) |
---|
133 | introRunning = false |
---|
134 | return true |
---|
135 | end |
---|
136 | |
---|