mirror of
https://github.com/guezoloic/racing-game.git
synced 2026-03-31 11:11:38 +00:00
fix: nom etat et ajout fuel
This commit is contained in:
13
src/Car.java
13
src/Car.java
@@ -13,6 +13,8 @@ public class Car {
|
||||
|
||||
/** Nombre total de cases dans une boucle (doit être > 0) */
|
||||
private final int loop;
|
||||
/** Nombre de fuel restant */
|
||||
private int fuel = 60;
|
||||
|
||||
/**
|
||||
* Construit une nouvelle voiture.
|
||||
@@ -73,4 +75,15 @@ public class Car {
|
||||
{
|
||||
return loop;
|
||||
}
|
||||
|
||||
public int getFuel()
|
||||
{
|
||||
return fuel;
|
||||
}
|
||||
|
||||
public Car consumeFuel()
|
||||
{
|
||||
fuel -= State.get().getConsumption();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user