Line | |
---|
1 | cellDoorOpened = false |
---|
2 | walkinCellFinished = false |
---|
3 | cellExitReached = false |
---|
4 | exitReached = false |
---|
5 | hangarReached = false |
---|
6 | spaceShipReached = false |
---|
7 | spaceShipEntered = false |
---|
8 | |
---|
9 | randTime = 0 |
---|
10 | |
---|
11 | function setCellDoor(timestep) |
---|
12 | cellDoorOpened = true |
---|
13 | return true |
---|
14 | end |
---|
15 | |
---|
16 | |
---|
17 | function walkInCell(timestep) |
---|
18 | |
---|
19 | if cellDoorOpened then |
---|
20 | |
---|
21 | if randTime == 0 then |
---|
22 | randTime = 30 * math.random() |
---|
23 | else |
---|
24 | randTime = randTime - timestep |
---|
25 | end |
---|
26 | |
---|
27 | if randTime < 0 then |
---|
28 | -- goto cellexit |
---|
29 | -- if exit reached: return true |
---|
30 | end |
---|
31 | |
---|
32 | end |
---|
33 | |
---|
34 | |
---|
35 | return false |
---|
36 | |
---|
37 | end |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | function goToExit(timestep) |
---|
42 | -- do not forget to make him wait until the player triggeres the trip to the hangar |
---|
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 | |
---|
72 | --io.write("Prisoner called \n") |
---|
73 | |
---|
74 | if not cellDoorOpend then |
---|
75 | walkinCellFinished = walkInCell(timestep) |
---|
76 | end |
---|
77 | |
---|
78 | if walkinCellFinished and not exitReached then |
---|
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.