Package com.dragonboat.game
Class ProgressBar
- java.lang.Object
-
- com.dragonboat.game.ProgressBar
-
public class ProgressBar extends java.lang.Object
Represents a progress bar.
-
-
Field Summary
Fields Modifier and Type Field Description com.badlogic.gdx.graphics.Texture
opponentIcon
com.badlogic.gdx.graphics.Texture
playerIcon
com.badlogic.gdx.graphics.Texture
texture
-
Constructor Summary
Constructors Constructor Description ProgressBar(Player player, Opponent[] opponents)
Creates a progress bar that tracks the player and opponent boats progress along the course.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allFinished(int finishY)
Returns true if all boats have finished.com.badlogic.gdx.graphics.Texture
getOpponentIcon()
Gets the opponent icon texture.com.badlogic.gdx.graphics.Texture
getPlayerIcon()
Gets the player icon texture.float
getPlayerTime()
Gets the time elapsed for the player in the current race.java.lang.String
getPlayerTimeString()
Gets the time elapsed for the player in the current race and total penalty time.float[]
getProgress(int finishY)
Gets the progress of all boats.com.badlogic.gdx.graphics.Texture
getTexture()
Gets the progress bar texture.float
getTime()
Gets the time passed for the current race.void
IncrementTimer(float timePassed)
Increments the timer by the time passed.void
StartTimer()
Resets the timer to zero.
-
-
-
Method Detail
-
StartTimer
public void StartTimer()
Resets the timer to zero.
-
IncrementTimer
public void IncrementTimer(float timePassed)
Increments the timer by the time passed.- Parameters:
timePassed
- The time delta from the last frame.
-
allFinished
public boolean allFinished(int finishY)
Returns true if all boats have finished.- Parameters:
finishY
- Y-position of the finish line.- Returns:
- Boolean representing if all boats have finished the course.
-
getProgress
public float[] getProgress(int finishY)
Gets the progress of all boats.- Parameters:
finishY
- Y-position of the finish line.- Returns:
- Array of floats representing the percentage of the course covered by each boat. First index stores player's progress.
-
getPlayerTime
public float getPlayerTime()
Gets the time elapsed for the player in the current race.- Returns:
- Returns a float representing the player's current race time.
-
getPlayerTimeString
public java.lang.String getPlayerTimeString()
Gets the time elapsed for the player in the current race and total penalty time.- Returns:
- String representing player time ":" penalty time.
-
getTime
public float getTime()
Gets the time passed for the current race.- Returns:
- Returns a float representing the current race time.
-
getTexture
public com.badlogic.gdx.graphics.Texture getTexture()
Gets the progress bar texture.- Returns:
- A Texture representing the sprite.
-
getPlayerIcon
public com.badlogic.gdx.graphics.Texture getPlayerIcon()
Gets the player icon texture.- Returns:
- A Texture representing the sprite.
-
getOpponentIcon
public com.badlogic.gdx.graphics.Texture getOpponentIcon()
Gets the opponent icon texture.- Returns:
- A Texture representing the sprite.
-
-