clickCell
This commit is contained in:
parent
5130096de8
commit
d6be7bff9c
|
|
@ -147,6 +147,18 @@ public class Simulator extends Thread {
|
||||||
*/
|
*/
|
||||||
public void clickCell(int x, int y) {
|
public void clickCell(int x, int y) {
|
||||||
//TODO : complete method
|
//TODO : complete method
|
||||||
|
if (clickActionFlag) {
|
||||||
|
for (Agent agent : agents) {
|
||||||
|
if(agent.getX() == x && agent.getY() == y) {
|
||||||
|
agents.remove(agent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agents.add(new Sheep(x,y));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
field[y][x] = (field[y][x] == 0) ? 1 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue