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 | return true |
---|
102 | end |
---|
103 | else |
---|
104 | pauseBurn = pauseBurn - 1 |
---|
105 | end |
---|
106 | return false |
---|
107 | end |
---|
108 | return false |
---|
109 | end |
---|
110 | |
---|
111 | function explodeSpaceship(timestep) |
---|
112 | --gameWorld:showText("BOOOOOOOOOOOOOOOOM"); |
---|
113 | explosion:setAbsCoor(1003, 226, -102) |
---|
114 | explosion:explode(boomSize,boomSize,boomSize) |
---|
115 | boomSize = boomSize + 10 |
---|
116 | if boomSize == 600 then |
---|
117 | return true |
---|
118 | end |
---|
119 | exploded = true |
---|
120 | return false |
---|
121 | end |
---|
122 | |
---|
123 | function hideCrashingSpaceship(timestep) |
---|
124 | IntroSpaceship:pause(true) |
---|
125 | IntroSpaceship:setVisibility(false) |
---|
126 | return true |
---|
127 | end |
---|
128 | |
---|
129 | function stopIntro(timestep) |
---|
130 | cameraManager:setCam("GameWorldCamera") |
---|
131 | --Player:pause(false) |
---|
132 | introRunning = false |
---|
133 | return true |
---|
134 | end |
---|
135 | |
---|