Package com.dragonboatrace.entities
Enum CollidableType
- java.lang.Object
-
- java.lang.Enum<CollidableType>
-
- com.dragonboatrace.entities.CollidableType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CollidableType>
public enum CollidableType extends java.lang.Enum<CollidableType>
Represents a type of collidable (obstacle or powerup)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BRANCH
HEAL
Increase the amount of health a boat has, up to the limit of its type.INVULN
Invulnerability.LEAF
LESSDAMAGE
Reduce how much damage the boat takes.LESSTIME
Reduce the amount of recorded time for the current round.ROCK
SPEEDUP
Increase the speed of the boat.
-
Field Summary
Fields Modifier and Type Field Description private CollidableEffect
effect
The effect the collidable has on the boat at a collision.private float
speed
The base speed at which the collidable moves.private java.lang.String
texture
The texture of the collidable.
-
Constructor Summary
Constructors Modifier Constructor Description private
CollidableType(java.lang.String texture, float speed, CollidableEffect effect)
Creates a new type of collidable with a given texture, base speed and an effect.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CollidableEffect
getEffect()
float
getSpeed()
Get the base speed of the collidable type.java.lang.String
getTexture()
Get the collidable types texturestatic int
getWeightedRandom()
static CollidableType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static CollidableType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ROCK
public static final CollidableType ROCK
-
BRANCH
public static final CollidableType BRANCH
-
LEAF
public static final CollidableType LEAF
-
INVULN
public static final CollidableType INVULN
Invulnerability. Setts the damage multiplier to 0 for a set amount of time, then sets it back to 1.
-
SPEEDUP
public static final CollidableType SPEEDUP
Increase the speed of the boat. Adds a certain amount to the current speed. Subtracts that amount after a certain time has passed. Speed is not just reset to the original number, in case the boat picks up another speed boost.
-
LESSDAMAGE
public static final CollidableType LESSDAMAGE
Reduce how much damage the boat takes. Like INVULN, but multiplier is not set to 0, so the boat still takes some damage. Multiplier is reset after a certain time has passed. These do not stack. No matter how many are picked up between picking up the first one and it running out, the multiplier will be reset to 1 when the first one runs out.
-
LESSTIME
public static final CollidableType LESSTIME
Reduce the amount of recorded time for the current round. No timeout.
-
HEAL
public static final CollidableType HEAL
Increase the amount of health a boat has, up to the limit of its type. No timeout. This one adds health as a fraction of total health, unlike the others which all are all constant. This is subject to change.
-
-
Field Detail
-
texture
private final java.lang.String texture
The texture of the collidable.
-
speed
private final float speed
The base speed at which the collidable moves.
-
effect
private final CollidableEffect effect
The effect the collidable has on the boat at a collision.
-
-
Constructor Detail
-
CollidableType
private CollidableType(java.lang.String texture, float speed, CollidableEffect effect)
Creates a new type of collidable with a given texture, base speed and an effect.- Parameters:
texture
- The path to the collidables texture.speed
- The speed of the collidable type.effect
- The effect of the Collidable on the boat
-
-
Method Detail
-
values
public static CollidableType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CollidableType c : CollidableType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CollidableType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getSpeed
public float getSpeed()
Get the base speed of the collidable type.- Returns:
- A float representing the speed of the collidable type.
-
getEffect
public CollidableEffect getEffect()
-
getTexture
public java.lang.String getTexture()
Get the collidable types texture- Returns:
- A string representing the path to the collidables texture.
-
getWeightedRandom
public static int getWeightedRandom()
-
-