it is done
This commit is contained in:
35
core/src/mindustry/entities/traits/TargetTrait.java
Normal file
35
core/src/mindustry/entities/traits/TargetTrait.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package mindustry.entities.traits;
|
||||
|
||||
import arc.math.geom.Position;
|
||||
import mindustry.game.Team;
|
||||
|
||||
/**
|
||||
* Base interface for targetable entities.
|
||||
*/
|
||||
public interface TargetTrait extends Position, VelocityTrait{
|
||||
|
||||
boolean isDead();
|
||||
|
||||
Team getTeam();
|
||||
|
||||
default float getTargetVelocityX(){
|
||||
if(this instanceof SolidTrait){
|
||||
return ((SolidTrait)this).getDeltaX();
|
||||
}
|
||||
return velocity().x;
|
||||
}
|
||||
|
||||
default float getTargetVelocityY(){
|
||||
if(this instanceof SolidTrait){
|
||||
return ((SolidTrait)this).getDeltaY();
|
||||
}
|
||||
return velocity().y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this entity is a valid target.
|
||||
*/
|
||||
default boolean isValid(){
|
||||
return !isDead();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user