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 protected Opponent[]
opponentBoats
com.badlogic.gdx.graphics.Texture
opponentIcon
protected Player
playerBoat
com.badlogic.gdx.graphics.Texture
playerIcon
protected float
playerTime
com.badlogic.gdx.graphics.Texture
texture
protected float
timeSeconds
-
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.ProgressBar(Player player, Opponent[] opponents, boolean noTexture)
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.
-
-
-
Field Detail
-
texture
public transient com.badlogic.gdx.graphics.Texture texture
-
playerIcon
public transient com.badlogic.gdx.graphics.Texture playerIcon
-
opponentIcon
public transient com.badlogic.gdx.graphics.Texture opponentIcon
-
playerBoat
protected transient Player playerBoat
-
opponentBoats
protected transient Opponent[] opponentBoats
-
timeSeconds
protected float timeSeconds
-
playerTime
protected float playerTime
-
-
Constructor Detail
-
ProgressBar
public ProgressBar(Player player, Opponent[] opponents)
Creates a progress bar that tracks the player and opponent boats progress along the course.- Parameters:
player
- The player's boat.opponents
- Array of opponent boats.
-
ProgressBar
public ProgressBar(Player player, Opponent[] opponents, boolean noTexture)
Creates a progress bar that tracks the player and opponent boats progress along the course.- Parameters:
player
- The player's boat.opponents
- Array of opponent boats.noTexture
- Debug parameter to stop LibGDX loading texture assets.
-
-
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.
-
-