Back to project page 4est.
The source code is released under:
MIT License
If you think the Android project 4est listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wordsaretoys.forest; /*from w ww .ja v a2 s. co m*/ import com.wordsaretoys.rise.utility.Interval; /** * manages game state */ public class Game { static float TimeoutPeriod = 100; // darkness timeout float timeout; // interval Interval interval = new Interval(); /** * ctor, set intial state */ public Game() { reset(); } /** * reset state after level completion */ public void reset() { timeout = TimeoutPeriod; } /** * update state */ public void update() { timeout -= interval.next(); if (timeout < 0) { reset(); } } /** * get normalized timeout value * @return 0..1 timeout */ public float getNormalTime() { return timeout / TimeoutPeriod; } }