| 1 | -- Get objects from orxonox |
|---|
| 2 | thisscript:addObject("FogEffect", "fog") |
|---|
| 3 | thisscript:addObject("RainEffect", "rain") |
|---|
| 4 | thisscript:addObject("SnowEffect", "snow") |
|---|
| 5 | thisscript:addObject("LightningEffect", "lightning") |
|---|
| 6 | thisscript:addObject("CloudEffect", "cloud") |
|---|
| 7 | |
|---|
| 8 | thisscript:addObject("Hover", "Player") |
|---|
| 9 | |
|---|
| 10 | -- Global Variables |
|---|
| 11 | fogActivated = false |
|---|
| 12 | rainActivated = false |
|---|
| 13 | snowActivated = false |
|---|
| 14 | lightningActivated = false |
|---|
| 15 | cloudActivated = false |
|---|
| 16 | |
|---|
| 17 | function tick(timestep) |
|---|
| 18 | |
|---|
| 19 | playerX = Player:getAbsCoorX() |
|---|
| 20 | playerY = Player:getAbsCoorY() |
|---|
| 21 | playerZ = Player:getAbsCoorZ() |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | if playerX > -1200 and not cloudActivated then |
|---|
| 25 | cloud:activate() |
|---|
| 26 | cloudActivated = true; |
|---|
| 27 | end |
|---|
| 28 | |
|---|
| 29 | if playerX > -1100 and cloudActivated then |
|---|
| 30 | cloud:cloudColor(1,0,0,5) |
|---|
| 31 | cloud:skyColor(0,0,0,5) |
|---|
| 32 | end |
|---|
| 33 | |
|---|
| 34 | --if playerX > -1000 and cloudActivated then |
|---|
| 35 | -- cloud:cloudColor(0.8,0.8,0.8,5) |
|---|
| 36 | -- cloud:skyColor(0,0,0.8,5) |
|---|
| 37 | --end |
|---|
| 38 | |
|---|
| 39 | --if playerX > -900 and not fogActivated then |
|---|
| 40 | -- fog:activate() |
|---|
| 41 | -- fogActivated = true |
|---|
| 42 | --end |
|---|
| 43 | |
|---|
| 44 | --if playerX > -800 and not snowActivated then |
|---|
| 45 | -- snow:activate() |
|---|
| 46 | -- snowActivated = true |
|---|
| 47 | --end |
|---|
| 48 | |
|---|
| 49 | --if playerX > -700 and snowActivated then |
|---|
| 50 | -- snow:deactivate() |
|---|
| 51 | -- fog:deactivate() |
|---|
| 52 | --end |
|---|
| 53 | |
|---|
| 54 | if playerX > -600 and not rainActivated then |
|---|
| 55 | rain:startRaining() |
|---|
| 56 | rainActivated = true |
|---|
| 57 | end |
|---|
| 58 | |
|---|
| 59 | if playerX > -500 and rainActivated and not lightningActivated then |
|---|
| 60 | lightning:activate() |
|---|
| 61 | lightningActivated = true |
|---|
| 62 | end |
|---|
| 63 | |
|---|
| 64 | if playerX > -300 and rainActivated and lightningActivated then |
|---|
| 65 | rain:stopRaining() |
|---|
| 66 | lightning:deactivate() |
|---|
| 67 | end |
|---|
| 68 | |
|---|
| 69 | return false |
|---|
| 70 | |
|---|
| 71 | end |
|---|