destroy for AI Player
This commit is contained in:
parent
20732e730c
commit
65451d6912
|
@ -35,6 +35,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void aiShoot() {
|
public void aiShoot() {
|
||||||
|
if (!this.myTurn) return;
|
||||||
this.enemy.receiveShoot(RandomPoint());
|
this.enemy.receiveShoot(RandomPoint());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -93,4 +94,20 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
|
||||||
|
|
||||||
this.aiShoot();
|
this.aiShoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
super.destroy();
|
||||||
|
Iterator<Thread> i = this.shootThreads.iterator();
|
||||||
|
while(i.hasNext()) {
|
||||||
|
Thread thread = i.next();
|
||||||
|
try {
|
||||||
|
thread.join();
|
||||||
|
i.remove();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue