Rev | Line | |
---|
[3946] | 1 | cellDoorOpened = false |
---|
| 2 | walkinCellFinished = false |
---|
| 3 | cellExitReached = false |
---|
[3945] | 4 | exitReached = false |
---|
| 5 | hangarReached = false |
---|
| 6 | spaceShipReached = false |
---|
| 7 | spaceShipEntered = false |
---|
| 8 | |
---|
[3946] | 9 | randTime = 0 |
---|
[3945] | 10 | |
---|
| 11 | function setCellDoor(timestep) |
---|
| 12 | cellDoorOpened = true |
---|
| 13 | return true |
---|
| 14 | end |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | function walkInCell(timestep) |
---|
| 18 | |
---|
[3946] | 19 | if cellDoorOpened then |
---|
| 20 | |
---|
| 21 | if randTime == 0 then |
---|
| 22 | randTime = 30 * math.random() |
---|
| 23 | else |
---|
| 24 | randTime = randTime - timestep |
---|
[3945] | 25 | end |
---|
| 26 | |
---|
[3946] | 27 | if randTime < 0 then |
---|
| 28 | -- goto cellexit |
---|
| 29 | -- if exit reached: return true |
---|
| 30 | end |
---|
[3945] | 31 | |
---|
[3946] | 32 | end |
---|
[3945] | 33 | |
---|
[3946] | 34 | |
---|
| 35 | return false |
---|
| 36 | |
---|
| 37 | end |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
[3945] | 41 | function goToExit(timestep) |
---|
[3946] | 42 | -- do not forget to make him wait until the player triggeres the trip to the hangar |
---|
[3945] | 43 | |
---|
| 44 | return false |
---|
| 45 | end |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | function goToHangar(timestep) |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | return false |
---|
| 52 | |
---|
| 53 | end |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | function goToSpaceship(timestep) |
---|
| 57 | |
---|
| 58 | return false |
---|
| 59 | |
---|
| 60 | end |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | function enterSpaceship(timestep) |
---|
| 64 | |
---|
| 65 | return false |
---|
| 66 | end |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | function tick(timestep) |
---|
| 71 | |
---|
[3946] | 72 | --io.write("Prisoner called \n") |
---|
| 73 | |
---|
[3945] | 74 | if not cellDoorOpend then |
---|
[3946] | 75 | walkinCellFinished = walkInCell(timestep) |
---|
[3945] | 76 | end |
---|
| 77 | |
---|
[3946] | 78 | if walkinCellFinished and not exitReached then |
---|
[3945] | 79 | exitReached = goToExit(timestep) |
---|
| 80 | end |
---|
| 81 | |
---|
| 82 | if exitReached and not hangarReached then |
---|
| 83 | hangarReached = goToHangar(timestep) |
---|
| 84 | end |
---|
| 85 | |
---|
| 86 | if hangarReached and not spaceShipReached then |
---|
| 87 | spaceShipReached = goToSpaceship(timestep) |
---|
| 88 | end |
---|
| 89 | |
---|
| 90 | if spaceShipReached and not spaceShipEntered then |
---|
| 91 | spaceShipEntered = enterSpaceship(timestep) |
---|
| 92 | end |
---|
| 93 | |
---|
| 94 | if spaceShipEntered then |
---|
| 95 | return true |
---|
| 96 | end |
---|
| 97 | |
---|
| 98 | return false |
---|
| 99 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.