83 lines
1.3 KiB
Java
83 lines
1.3 KiB
Java
|
|
package ei.game.network.entities;
|
||
|
|
|
||
|
|
import ei.engine.math.Vector2i;
|
||
|
|
import ei.game.gamestate.InGameState;
|
||
|
|
import ei.game.player.Player;
|
||
|
|
import ei.game.scene.units.Unit;
|
||
|
|
|
||
|
|
public abstract class NetworkUnit extends Unit{
|
||
|
|
private static int nextId;
|
||
|
|
private int unitId = -1;
|
||
|
|
|
||
|
|
public NetworkUnit(int l, Player p) {
|
||
|
|
super(l, p);
|
||
|
|
unitId = nextId;
|
||
|
|
nextId++;
|
||
|
|
}
|
||
|
|
|
||
|
|
public NetworkUnit(int l, Vector2i pos, Player p) {
|
||
|
|
super(l, pos, p);
|
||
|
|
unitId = nextId;
|
||
|
|
nextId++;
|
||
|
|
}
|
||
|
|
|
||
|
|
public int getUnitId(){
|
||
|
|
return unitId;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected void move(int x, int y, boolean b) {
|
||
|
|
if(!InGameState.isNetwork()){
|
||
|
|
super.move(x, y, b);
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void attack(Vector2i target, boolean play) {
|
||
|
|
if(!InGameState.isNetwork()){
|
||
|
|
super.attack(target, play);
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void remove(){
|
||
|
|
if(!InGameState.isNetwork()){
|
||
|
|
super.remove();
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setPos(int x, int y) {
|
||
|
|
if(!InGameState.isNetwork()){
|
||
|
|
super.setPos(x, y);
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void forcePos(int x, int y){
|
||
|
|
if(!InGameState.isNetwork()){
|
||
|
|
super.forcePos(x, y);
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void update() {
|
||
|
|
if(!InGameState.isNetwork()){
|
||
|
|
super.update();
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|