|
|
@ -7,6 +7,7 @@ public class GameManager { |
|
|
|
public Visualizer visualizer; |
|
|
|
public Player player; |
|
|
|
public int score = 0; |
|
|
|
public Boolean ghostIsEdible = false; |
|
|
|
|
|
|
|
public GameManager() { |
|
|
|
setupGame(); |
|
|
@ -28,9 +29,23 @@ public class GameManager { |
|
|
|
if(time%5 == 0) { |
|
|
|
player.Move(); |
|
|
|
} |
|
|
|
if(time == 300) { |
|
|
|
spawnCherry(); |
|
|
|
} |
|
|
|
if (time == 600) { |
|
|
|
destroyCherry(); |
|
|
|
} |
|
|
|
time++; |
|
|
|
} |
|
|
|
|
|
|
|
public void spawnCherry() { |
|
|
|
map.GetCell(map.playerSpawn).type = "cherry"; |
|
|
|
} |
|
|
|
|
|
|
|
public void destroyCherry() { |
|
|
|
map.GetCell(map.playerSpawn).type = "empty"; |
|
|
|
} |
|
|
|
|
|
|
|
public void ProcessInput(char inputChar) { |
|
|
|
if(inputChar == 27) { |
|
|
|
//todo: escape key pauses game |
|
|
@ -59,4 +74,15 @@ public class GameManager { |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public void updatePlayerCell() { |
|
|
|
map.GetCell(player.position).triggerItem(); |
|
|
|
} |
|
|
|
|
|
|
|
public void makeGhostEdible(int timeStopPillEffect) { |
|
|
|
ghostIsEdible = true; |
|
|
|
if(time == timeStopPillEffect) { |
|
|
|
ghostIsEdible = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |