Quote:
Originally Posted by Ether
Thanks for the response. I hope you don't mind some follow-up questions:
What does the waitCommand() do, "under the hood". i.e., how is it implemented?
Is there a "recommended" or "best practice" way to implement that approach?
|
I haven't looked at the wait command under the hood, but this is how I believe it works. I can look under the hood tonight at the source code and see if I'm correct.
Code:
public class WaitCommand extends Command {
private double waitTime;
public WaitCommand(double waitTime) {
this.waitTime = waitTime;
}
public boolean isFinished() {
return timeSinceInitialized >= waitTme;
}
}
As to the second question. Something like this would work for a single command doing multiple things based on time.
Code:
public void execute() {
if (timeSinceInitialized() < sometime) {
do something;
} else if(timeSinceInitialized() < some bigger time) {
do something 2;
} else {
do something 3;
}
}