2020-03-23 12:30:18 +01:00
|
|
|
package inf112.fiasko.roborally.objects;
|
|
|
|
|
2020-04-14 15:54:09 +02:00
|
|
|
import inf112.fiasko.roborally.elementproperties.Direction;
|
|
|
|
import inf112.fiasko.roborally.elementproperties.ParticleType;
|
2020-03-23 12:30:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|