mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-08 02:59:36 +01:00
Legger til en partikkeltype klasse
This commit is contained in:
parent
6ca9f0168d
commit
1d9e1b3d43
@ -0,0 +1,40 @@
|
|||||||
|
package inf112.fiasko.roborally.element_properties;
|
||||||
|
|
||||||
|
public enum ParticleType {
|
||||||
|
LASER_BEAM_SINGLE (1),
|
||||||
|
LASER_BEAM_DOUBLE (2),
|
||||||
|
LASER_BEAM_SINGLE_CROSS (3),
|
||||||
|
LASER_BEAM_DOUBLE_CROSS (4);
|
||||||
|
|
||||||
|
private final int particleTypeID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to let a particle type be represented by a numerical identifier
|
||||||
|
* @param particleTypeID <p>The numerical identifier assigned to the particle type</p>
|
||||||
|
*/
|
||||||
|
ParticleType(int particleTypeID) {
|
||||||
|
this.particleTypeID = particleTypeID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the numerical id used for alternate identification of a tile type
|
||||||
|
* @return <p>The numerical id of the tile type</p>
|
||||||
|
*/
|
||||||
|
public int getParticleTypeID() {
|
||||||
|
return this.particleTypeID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a particle type value from its numerical representation
|
||||||
|
* @param particleTypeID <p>The numerical representation of a particle type</p>
|
||||||
|
* @return <p>The enum value representing the particle type, or null if the id is invalid</p>
|
||||||
|
*/
|
||||||
|
public static ParticleType getParticleTypeFromID(int particleTypeID) {
|
||||||
|
for (ParticleType type : ParticleType.values()) {
|
||||||
|
if (type.particleTypeID == particleTypeID) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user