S5-VR-Game / game

2 stars 0 forks source link

Game code extension #32

Closed Aremju closed 10 months ago

Aremju commented 10 months ago

Hey Jonas, just made some updates of your project, you can now determine whether the game has failed or not in a specific Method. We can also now differ between Timer Task that are using a Timer and between Tasks that do not have a Timer. Just have a look at the changes, pull the branch and have a look at it for yourself :)

JonasPTFL commented 10 months ago

The code looks good to me, but i made some minor optimizations and improvements as you can see in the first three commits i added. I also added a missing feature, that enables subclasses of the TimerTask class to set an initial remainingTime and not rely on a static value of 5 seconds.

I think the idea of a template method based structure fits well for the abstract GameTask class, as you started to implement with the CheckTaskState method. Because of this i extended the structure by adding a BeforeStateCheck and AfterStateCheck method, which are invoked in the Update method of the GameTask base class. Therefore the NotTimerTask class is redundant, as the logic is implemented in the base class.

What do you think of this idea and my changes (especially the last two commits)? Is this a useful addition? I think it is better to not have a NotTimerTask class, but implement the shared logic in the base class.