mirror of
https://github.com/guezoloic/racing-game.git
synced 2026-03-31 03:01:38 +00:00
rework: ajout plusieurs classes et modification logique
This commit is contained in:
@@ -5,7 +5,7 @@ import java.util.Random;
|
||||
* Chaque appel à {@link #makeMove()} avance la voiture d'une position.
|
||||
* Quand la position atteint la fin de la boucle, un nouveau tour est compté.
|
||||
*/
|
||||
public class Car implements GObserver
|
||||
public class Car
|
||||
{
|
||||
/** Ajout de la classe Random (Evite de le recreer a chaque fois) */
|
||||
private Random rand = new Random();
|
||||
@@ -97,8 +97,7 @@ public class Car implements GObserver
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply()
|
||||
public void run()
|
||||
{
|
||||
if (this.fuel > 0)
|
||||
{
|
||||
@@ -106,8 +105,6 @@ public class Car implements GObserver
|
||||
int random = rand.nextInt(interval[0], interval[1]);
|
||||
makeMove(random).consumeFuel();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getPos()
|
||||
|
||||
Reference in New Issue
Block a user