Rev | Line | |
---|
[4091] | 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 |
---|
[4095] | 12 | rainActivated = false |
---|
| 13 | snowActivated = false |
---|
| 14 | lightningActivated = false |
---|
| 15 | cloudActivated = false |
---|
[4091] | 16 | |
---|
| 17 | function tick(timestep) |
---|
| 18 | |
---|
[4095] | 19 | playerX = Player:getAbsCoorX() |
---|
| 20 | playerY = Player:getAbsCoorY() |
---|
| 21 | playerZ = Player:getAbsCoorZ() |
---|
[4091] | 22 | |
---|
[4099] | 23 | |
---|
[4108] | 24 | if playerX > -1200 and not cloudActivated then |
---|
| 25 | cloud:activate() |
---|
| 26 | cloudActivated = true; |
---|
| 27 | end |
---|
[4091] | 28 | |
---|
[4108] | 29 | if playerX > -900 and not fogActivated then |
---|
| 30 | fog:activate() |
---|
| 31 | fogActivated = true |
---|
| 32 | end |
---|
[4091] | 33 | |
---|
[4108] | 34 | if playerX > -800 and not snowActivated then |
---|
| 35 | snow:activate() |
---|
| 36 | snowActivated = true |
---|
| 37 | end |
---|
[4099] | 38 | |
---|
[4108] | 39 | if playerX > -700 and snowActivated then |
---|
| 40 | snow:deactivate() |
---|
| 41 | fog:deactivate() |
---|
| 42 | end |
---|
[4099] | 43 | |
---|
[4108] | 44 | if playerX > -600 and not rainActivated then |
---|
| 45 | rain:startRaining() |
---|
| 46 | rainActivated = true |
---|
| 47 | end |
---|
[4099] | 48 | |
---|
[4108] | 49 | if playerX > -500 and rainActivated and not lightningActivated then |
---|
| 50 | lightning:activate() |
---|
| 51 | lightningActivated = true |
---|
| 52 | end |
---|
[4091] | 53 | |
---|
[4108] | 54 | if playerX > -300 and rainActivated then |
---|
| 55 | rain:stopRaining() |
---|
| 56 | lightning:deactivate() |
---|
| 57 | end |
---|
[4091] | 58 | |
---|
[4108] | 59 | return false |
---|
| 60 | --return true |
---|
[4091] | 61 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.