1 | --register classes |
---|
2 | thisscript:registerClass("Explosion") |
---|
3 | -- Get objects from orxonox |
---|
4 | thisscript:addObject("SpaceShip", "Player") |
---|
5 | thisscript:addObject("CameraMan", "cameraManager") |
---|
6 | thisscript:addObjectAsName("GameWorld", "Mission 1", "gameWorld") |
---|
7 | |
---|
8 | triggerFadeOut = SpaceTrigger() |
---|
9 | triggerFadeOut:setScript("vs1.lua") |
---|
10 | triggerFadeOut:setFunction("explodeSpaceship") |
---|
11 | triggerFadeOut:setRadius(380) |
---|
12 | triggerFadeOut:setTarget("Player") |
---|
13 | triggerFadeOut:setAbsCoor(3610, 116, -656) |
---|
14 | triggerFadeOut:setDebugDraw(true) |
---|
15 | |
---|
16 | triggerSwitchCam = SpaceTrigger() |
---|
17 | triggerSwitchCam:setScript("vs1.lua") |
---|
18 | triggerSwitchCam:setFunction("switchCam") |
---|
19 | triggerSwitchCam:setRadius(400) |
---|
20 | triggerSwitchCam:setTarget("Player") |
---|
21 | triggerSwitchCam:setAbsCoor(3610, 116, -656) |
---|
22 | triggerSwitchCam:setDebugDraw(true) |
---|
23 | |
---|
24 | triggerEndLevel = TimeTrigger() |
---|
25 | triggerEndLevel:setScript("vs1.lua") |
---|
26 | triggerEndLevel:setFunction("changeLevel") |
---|
27 | triggerEndLevel:setDelay(5) |
---|
28 | |
---|
29 | --initialisation |
---|
30 | explosion = Explosion() |
---|
31 | explosion:setExplosionSound("sounds/explosions/explosion_6_BIG.wav") |
---|
32 | cameraManager:changeTarget("cameraOne","SpaceShip", "Player") |
---|
33 | |
---|
34 | -- globals |
---|
35 | boomSize = 25 |
---|
36 | |
---|
37 | |
---|
38 | function changeLevel(timestep) |
---|
39 | gameWorld:setNextStoryName("Moonstation") |
---|
40 | gameWorld:stop() |
---|
41 | return true |
---|
42 | end |
---|
43 | |
---|
44 | |
---|
45 | function explodeSpaceship(timestep) |
---|
46 | explosion:setAbsCoor(Player:getAbsCoorX(),Player:getAbsCoorY(),Player:getAbsCoorZ()) |
---|
47 | explosion:explode(boomSize,boomSize,boomSize) |
---|
48 | boomSize = boomSize + 4 |
---|
49 | if boomSize > 75 then |
---|
50 | triggerEndLevel:start() |
---|
51 | cameraManager:toggleFade() |
---|
52 | gameWorld:showText("We have been hit...") |
---|
53 | gameWorld:showText("Initialising emergency sequence!") |
---|
54 | return true |
---|
55 | end |
---|
56 | return false |
---|
57 | end |
---|
58 | |
---|
59 | function switchCam(timestep) |
---|
60 | cameraManager:setCam("cameraOne") |
---|
61 | return true |
---|
62 | end |
---|