mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-08 02:59:36 +01:00
Legger til en partikkel klasse
This commit is contained in:
parent
1d9e1b3d43
commit
27535beeb8
42
src/main/java/inf112/fiasko/roborally/objects/Particle.java
Normal file
42
src/main/java/inf112/fiasko/roborally/objects/Particle.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package inf112.fiasko.roborally.objects;
|
||||||
|
|
||||||
|
import inf112.fiasko.roborally.element_properties.Direction;
|
||||||
|
import inf112.fiasko.roborally.element_properties.ParticleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents a particle
|
||||||
|
*/
|
||||||
|
public class Particle {
|
||||||
|
|
||||||
|
private ParticleType particleType;
|
||||||
|
private Direction direction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new particle
|
||||||
|
* @param particleType The type of the particle
|
||||||
|
* @param direction The direction of the particle
|
||||||
|
*/
|
||||||
|
public Particle(ParticleType particleType, Direction direction) {
|
||||||
|
if (direction.getDirectionID() % 2 == 0) {
|
||||||
|
throw new IllegalArgumentException("Invalid direction for particle submitted");
|
||||||
|
}
|
||||||
|
this.particleType = particleType;
|
||||||
|
this.direction = direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the particle type of the particle
|
||||||
|
* @return The particle's particle type
|
||||||
|
*/
|
||||||
|
public ParticleType getParticleType() {
|
||||||
|
return particleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the direction of the particle
|
||||||
|
* @return The particle's direction
|
||||||
|
*/
|
||||||
|
public Direction getDirection() {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user