Experimental positional spawn support / WIP map
This commit is contained in:
@@ -36,10 +36,12 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
||||
public float unitScaling = never;
|
||||
/** Shield points that this unit has. */
|
||||
public float shields = 0f;
|
||||
/** How much shields get increased per wave. */
|
||||
/** How much shields get increased by per wave. */
|
||||
public float shieldScaling = 0f;
|
||||
/** Amount of enemies spawned initially, with no scaling */
|
||||
public int unitAmount = 1;
|
||||
/** If not -1, the unit will only spawn in spawnpoints with these packed coordinates. */
|
||||
public int spawn = -1;
|
||||
/** Seq of payloads that this unit will spawn with. */
|
||||
public @Nullable Seq<UnitType> payloads;
|
||||
/** Status effect applied to the spawned unit. Null to disable. */
|
||||
@@ -55,6 +57,10 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
||||
//serialization use only
|
||||
}
|
||||
|
||||
public boolean canSpawn(int position){
|
||||
return spawn == -1 || spawn == position;
|
||||
}
|
||||
|
||||
/** @return amount of units spawned on a specific wave. */
|
||||
public int getSpawned(int wave){
|
||||
if(spacing == 0) spacing = 1;
|
||||
@@ -111,6 +117,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
||||
if(shieldScaling != 0) json.writeValue("shieldScaling", shieldScaling);
|
||||
if(unitAmount != 1) json.writeValue("amount", unitAmount);
|
||||
if(effect != null) json.writeValue("effect", effect.name);
|
||||
if(spawn != -1) json.writeValue("spawn", spawn);
|
||||
if(payloads != null && payloads.size > 0){
|
||||
json.writeValue("payloads", payloads.map(u -> u.name).toArray(String.class));
|
||||
}
|
||||
@@ -130,6 +137,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
||||
shields = data.getFloat("shields", 0);
|
||||
shieldScaling = data.getFloat("shieldScaling", 0);
|
||||
unitAmount = data.getInt("amount", 1);
|
||||
spawn = data.getInt("spawn", -1);
|
||||
if(data.has("payloads")){
|
||||
payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.getByName(ContentType.unit, s));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user