我的方法waitOut(seconds)
被开发为等待一段时间,直到它传递到它之间的下一行代码。
例如:
System.out.println(“我要吃芝士汉堡”);
waitOut(10); //< - 10秒,在方法中转换了
System.out.println(“我吃了一口芝士汉堡”);
这是班级
package Time;
import java.util.Timer;
import java.util.TimerTask;
/*
* Developed for time passing of the game itself, doens't afflict with universal time
*/
public class Timelapse {
private static int timeInSeconds=0;
private int timeInMinutes=0;
private boolean day = true, night = false;
private static Timer ourClock;
private static TimerTask ourTask;
public static void waitOut(int seconds) { // Method created for the time behind message print outs
int num = seconds * 1000;
ourClock = new Timer();
ourTask = new Task();
ourClock.scheduleAtFixedRate(ourTask,1000,1000);
}
}