Added test unit type
This commit is contained in:
@@ -122,7 +122,7 @@ public class Logic extends Module {
|
||||
Entities.update(Entities.defaultGroup());
|
||||
Entities.update(bulletGroup);
|
||||
for(EntityGroup group : unitGroups){
|
||||
if(!group.isEmpty()) Entities.update(group);
|
||||
Entities.update(group);
|
||||
}
|
||||
Entities.update(tileGroup);
|
||||
Entities.update(shieldGroup);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
10
core/src/io/anuke/mindustry/entities/units/types/Scout.java
Normal file
10
core/src/io/anuke/mindustry/entities/units/types/Scout.java
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
6
core/src/io/anuke/mindustry/io/MapIO.java
Normal file
6
core/src/io/anuke/mindustry/io/MapIO.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package io.anuke.mindustry.io;
|
||||
|
||||
/**Reads and writes map files.*/
|
||||
public class MapIO {
|
||||
//TODO implementation
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package io.anuke.mindustry.ui.fragments;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.UnitTypes;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.builders.button;
|
||||
@@ -46,17 +48,13 @@ public class DebugFragment implements Fragment {
|
||||
row();
|
||||
new button("noclip", "toggle", () -> noclip = !noclip);
|
||||
row();
|
||||
new button("hideplayer", "toggle", () -> showPlayer = !showPlayer);
|
||||
row();
|
||||
new button("blocks", "toggle", () -> showBlockDebug = !showBlockDebug);
|
||||
row();
|
||||
new button("paths", "toggle", () -> showPaths = !showPaths);
|
||||
row();
|
||||
new button("wave", () -> state.wavetime = 0f);
|
||||
row();
|
||||
new button("time 0", () -> Timers.resetTime(0f));
|
||||
row();
|
||||
new button("time max", () -> Timers.resetTime(1080000 - 60*10));
|
||||
new button("spawn", () -> new BaseUnit(UnitTypes.scout).set(player.x, player.y).add());
|
||||
row();
|
||||
}}.end();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user