Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加终止条件,完成讨论#51 #46 #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/MyPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,22 @@ public void paint(Graphics g) {
public Timer timer = new Timer();

class MyTimerTask extends TimerTask {
public boolean isStop(){
boolean result=false;
//动画重绘终止条件, 以被隔离达到或超过100人时停止为例。
//if (PersonPool.getInstance().getPeopleSize(Person.State.FREEZE)>=100) {result = true;};
//运行到世界时间30天。
//if ((int) (worldTime / 10.0)>=30) {result = true;};
return result;
}

@Override
public void run() {
MyPanel.this.repaint();
worldTime++;
//增加动画重绘终止条件
if (!this.isStop()) {
MyPanel.this.repaint();
worldTime++;
}
}
}

Expand Down