package de.nameless.gameEngine.gameObjects;
import java.util.Vector;
import de.nameless.graphicEngine.animation.lib.NEAabsoluteMove;
public abstract class NELandUnit extends NEUnit {
private static final long serialVersionUID = 1L;
public NELandUnit(int ownerID) {
super(ownerID);
}
@Override
public void placeUnitOnSquare(NEField square) {
square.containtLUnit = this;
if(this.square != null) this.square.containtLUnit = null;
super.placeUnitOnSquare(square);
this.x = square.getGLX();
this.y = square.getGLY();
}
@Override
public void moveTo(NEField square){
this.square.containtLUnit = null;
this.placeUnitOnSquare(square);
if(main != null && selected!=null){
main.addAnimation(new NEAabsoluteMove(square.getGLX(),square.getGLY(),11f));
super.putGfxPos();
moved.set();
}
}
@Override
public void jumpTo(NEField square) {
this.placeUnitOnSquare(square);
main.endAllAnimation();
this.x = square.x;
this.y = square.y;
main.x = this.x;
main.y = this.y;
}
/**
* Startet Eine Animation die dem angegebenen Pafad folgt.
*
*/
public void followPath(Vector<NEField> way){
this.placeUnitOnSquare(way.lastElement());
if(main != null && selected!=null){
NEUnitFollowPathAnimation a = new NEUnitFollowPathAnimation(this.getSquare(), way);
main.addAnimation(a);
super.putGfxPos();
moved.set();
}
}
}