Added test unit type

This commit is contained in:
Anuken
2018-03-16 21:48:44 -04:00
parent ad2e2032e6
commit 714fdc751a
47 changed files with 323 additions and 277 deletions
@@ -86,8 +86,12 @@ public class BaseUnit extends Unit {
@Override
public void added(){
maxhealth = type.health;
hitbox.setSize(type.hitsize);
hitboxTile.setSize(type.hitsizeTile);
heal();
}
@Override
@@ -117,6 +121,7 @@ public class BaseUnit extends Unit {
data.putFloat(x);
data.putFloat(y);
data.putShort((short)(rotation *2));
data.putShort((short)(baseRotation *2));
data.putShort((short)health);
}
@@ -124,10 +129,11 @@ public class BaseUnit extends Unit {
public void read(ByteBuffer data, long time) {
float x = data.getFloat();
float y = data.getFloat();
short angle = data.getShort();
short rotation = data.getShort();
short baserotation = data.getShort();
short health = data.getShort();
interpolator.read(this.x, this.y, x, y, rotation/2f, baserotation/2f, time);
this.health = health;
interpolator.read(this.x, this.y, x, y, angle/2f, time);
}
}
@@ -77,11 +77,12 @@ public abstract class UnitType {
if(Net.server()){
NetEvents.handleUnitDeath(unit);
}
unit.remove();
}
public void onRemoteDeath(BaseUnit unit){
onDeath(unit);
unit.remove();
}
public void removed(BaseUnit unit){
@@ -1,5 +1,9 @@
package io.anuke.mindustry.entities.units;
import io.anuke.mindustry.entities.units.types.Scout;
public class UnitTypes {
//TODO list types here.
public static final UnitType
scout = new Scout();
}
@@ -0,0 +1,10 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.GroundUnitType;
public class Scout extends GroundUnitType {
public Scout(){
super("scout");
}
}