Added som thing so to make the game network compatible
This commit is contained in:
parent
cbd673472f
commit
380492de56
32 changed files with 368 additions and 42 deletions
82
src/ei/game/network/entities/NetworkUnit.java
Normal file
82
src/ei/game/network/entities/NetworkUnit.java
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
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{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue