//checkTime: GameTime TimerComponent -> Boolean //purpose: checks if the timer has ended public Boolean checkTime(GameTime gameTime, TimerComponent myTime) { //myTime.displayValue = "f**k you"; if (myTime.isComplete == false) { //myTime.displayValue = "f**k you"; //ensuring a second has past if (gameTime.TotalGameTime.Seconds > myTime.startCount) { myTime.startCount = gameTime.TotalGameTime.Seconds; myTime.endCount = myTime.endCount - 1; myTime.displayValue = timerView(myTime.endCount); //myTime.displayValue = "f**k you"; //timer done if (myTime.endCount <= 0) { myTime.endCount = 0; myTime.isComplete = true; myTime.displayValue = "0"; } } } return myTime.isComplete; }
//setTime: GameTime int TimerComponent -> void //Purpose: Sets the timer at the start of a game public void setTime(GameTime gameTime, int secs, TimerComponent myTime) { myTime.startCount = gameTime.TotalGameTime.Seconds; myTime.endCount = myTime.startCount + secs; myTime.isComplete = false; myTime.isActive = true; myTime.displayValue = "Start"; }
//resetTimer: TimerComponent -> void //purpose: resets the timer for future games (possibly opperations) public void resetTimer(TimerComponent myTime) { myTime.startCount = 0; myTime.endCount = 0; myTime.displayValue = "None"; myTime.isActive = false; myTime.isComplete = false; }