Package com.dragonboatrace.tools
Class Race
- java.lang.Object
-
- com.dragonboatrace.tools.Race
-
public class Race extends java.lang.ObjectRepresents a Race.
-
-
Field Summary
Fields Modifier and Type Field Description private com.badlogic.gdx.graphics.TexturebarrierThe separator between each lane.private java.util.ArrayList<ComputerBoat>computerBoatsThe list of boats in the race, not including the player.private intlengthThe length of the race.private BoatplayerThe players boat.private FinishLinetheFinishThe finish line.private floattimerThe timer for the race.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()booleanequals(java.lang.Object obj)java.util.Set<java.lang.Float>findDuplicates(java.util.ArrayList<java.lang.Float> list)Find any duplicates in an arraylist of floats.voidgetLeaderBoard(DragonBoatRace game)Generate the leaderboard from the race that just occurred and then show the next round screen.BoatgetPlayer()Get the players boat.voidrender(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)Render the boats in the race and the player boat.voidrestore()voidsave()voidupdate(float deltaTime, DragonBoatRace game)Update the race in respects to the amount of time passed since the last frame.
-
-
-
Field Detail
-
length
private final int length
The length of the race.
-
computerBoats
private final java.util.ArrayList<ComputerBoat> computerBoats
The list of boats in the race, not including the player.
-
player
private final Boat player
The players boat.
-
theFinish
private final FinishLine theFinish
The finish line.
-
barrier
private final com.badlogic.gdx.graphics.Texture barrier
The separator between each lane.
-
timer
private float timer
The timer for the race.
-
-
Method Detail
-
update
public void update(float deltaTime, DragonBoatRace game)Update the race in respects to the amount of time passed since the last frame.- Parameters:
deltaTime- The time since the last frame.game- The instance of the game.
-
render
public void render(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
Render the boats in the race and the player boat.- Parameters:
batch- The SpriteBatch to be added to.
-
getLeaderBoard
public void getLeaderBoard(DragonBoatRace game)
Generate the leaderboard from the race that just occurred and then show the next round screen.- Parameters:
game- The instance of the game.
-
findDuplicates
public java.util.Set<java.lang.Float> findDuplicates(java.util.ArrayList<java.lang.Float> list)
Find any duplicates in an arraylist of floats.- Parameters:
list- AnArrayListof floats to be combed through.- Returns:
- An
Setof type float containing unique values.
-
getPlayer
public Boat getPlayer()
Get the players boat.- Returns:
- A
Boatrepresenting the players boat.
-
dispose
public void dispose()
-
restore
public void restore()
-
save
public void save()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-