[4835] | 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 | -- Initialisation |
---|
| 8 | triggerInit = ScriptTrigger() |
---|
| 9 | triggerInit:setScript("intro.lua") |
---|
| 10 | triggerInit:setFunction("startIntro") |
---|
| 11 | triggerInit:setActiveOnCreation(true) |
---|
| 12 | |
---|
| 13 | -- Camera2MoonstationCenter |
---|
| 14 | triggerMoonstation = ScriptTrigger() |
---|
| 15 | triggerMoonstation:setScript("intro.lua") |
---|
| 16 | triggerMoonstation:setFunction("showMoonstation") |
---|
| 17 | triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807) |
---|
| 18 | triggerMoonstation:setTarget("CameraIntro") |
---|
| 19 | triggerMoonstation:setRadius(150) |
---|
| 20 | triggerMoonstation:setDebugDraw(true) |
---|
| 21 | |
---|
| 22 | -- Camera2MoonstationCenter |
---|
| 23 | triggerShowCrash = ScriptTrigger() |
---|
| 24 | triggerShowCrash:setScript("intro.lua") |
---|
| 25 | triggerShowCrash:setFunction("showCrashingSpaceship") |
---|
| 26 | triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926) |
---|
| 27 | triggerShowCrash:setTarget("CameraIntro") |
---|
| 28 | triggerShowCrash:setRadius(200) |
---|
| 29 | triggerShowCrash:setDebugDraw(true) |
---|
| 30 | |
---|
| 31 | --hide crashing ship |
---|
| 32 | triggerShowCrash = ScriptTrigger() |
---|
| 33 | triggerShowCrash:setScript("intro.lua") |
---|
| 34 | triggerShowCrash:setFunction("hideCrashingSpaceship") |
---|
| 35 | triggerShowCrash:setAbsCoor(-100, -400, -110) |
---|
| 36 | triggerShowCrash:setTarget("IntroSpaceship") |
---|
| 37 | triggerShowCrash:setRadius(60) |
---|
| 38 | triggerShowCrash:setDebugDraw(true) |
---|
| 39 | |
---|
| 40 | -- End of Intro |
---|
| 41 | triggerEndIntro = ScriptTrigger() |
---|
| 42 | triggerEndIntro:setScript("intro.lua") |
---|
| 43 | triggerEndIntro:setFunction("stopIntro") |
---|
| 44 | triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880) |
---|
| 45 | triggerEndIntro:setTarget("CameraIntro") |
---|
| 46 | triggerEndIntro:setRadius(110) |
---|
| 47 | triggerEndIntro:setDebugDraw(true) |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | -- Functions -------------------------------------------------- |
---|
| 51 | -- globals |
---|
| 52 | introRunning = false |
---|
| 53 | spaceshipCrashDelay = 2 |
---|
| 54 | |
---|
| 55 | -- init function |
---|
| 56 | function startIntro(timestep) |
---|
| 57 | gameWorld:showText("Moon Surface 2042"); |
---|
| 58 | cameraManager:setCam("CameraIntro") |
---|
| 59 | cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780) |
---|
| 60 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
| 61 | cameraManager:initFadeBlack() |
---|
| 62 | cameraManager:toggleFade() |
---|
| 63 | |
---|
| 64 | IntroSpaceship:pause(true) |
---|
| 65 | --Player:pause(true) |
---|
| 66 | introRunning = true |
---|
| 67 | |
---|
| 68 | return true --just once |
---|
| 69 | end |
---|
| 70 | |
---|
| 71 | function showMoonstation(timestep) |
---|
| 72 | cameraManager:changeCurrTarget("Building", "MoonstationCenterHack") |
---|
| 73 | return true |
---|
| 74 | end |
---|
| 75 | |
---|
| 76 | function showCrashingSpaceship(timestep) |
---|
| 77 | cameraManager:changeCurrTarget("NPC", "IntroSpaceship") |
---|
| 78 | spaceshipCrashDelay = spaceshipCrashDelay - timestep |
---|
| 79 | if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate |
---|
| 80 | IntroSpaceship:pause(false) |
---|
| 81 | return true |
---|
| 82 | end |
---|
| 83 | return false |
---|
| 84 | end |
---|
| 85 | |
---|
| 86 | function hideCrashingSpaceship(timestep) |
---|
| 87 | --IntroSpaceship:setVisibility(false) --BUG affects all npc |
---|
| 88 | IntroSpaceship:pause(true) |
---|
| 89 | return true |
---|
| 90 | end |
---|
| 91 | |
---|
| 92 | function stopIntro(timestep) |
---|
| 93 | cameraManager:setCam("GameWorldCamera") |
---|
| 94 | --Player:pause(false) |
---|
| 95 | introRunning = false |
---|
| 96 | return true |
---|
| 97 | end |
---|
| 98 | |
---|