Package com.dragonboat.game
Class ProgressBar
- java.lang.Object
-
- com.dragonboat.game.ProgressBar
-
public class ProgressBar extends java.lang.ObjectRepresents a progress bar.
-
-
Field Summary
Fields Modifier and Type Field Description com.badlogic.gdx.graphics.TextureopponentIconcom.badlogic.gdx.graphics.TextureplayerIconcom.badlogic.gdx.graphics.Texturetexture
-
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 booleanallFinished(int finishY)Returns true if all boats have finished.com.badlogic.gdx.graphics.TexturegetOpponentIcon()Gets the opponent icon texture.com.badlogic.gdx.graphics.TexturegetPlayerIcon()Gets the player icon texture.floatgetPlayerTime()Gets the time elapsed for the player in the current race.java.lang.StringgetPlayerTimeString()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.TexturegetTexture()Gets the progress bar texture.floatgetTime()Gets the time passed for the current race.voidIncrementTimer(float timePassed)Increments the timer by the time passed.voidStartTimer()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.
-
-