Added land effect / Cleanup
This commit is contained in:
@@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class UnitFx extends FxList implements ContentList{
|
||||
public static Effect vtolHover, unitDrop, unitPickup, pickup;
|
||||
public static Effect vtolHover, unitDrop, unitPickup, unitLand, pickup;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -32,6 +32,14 @@ public class UnitFx extends FxList implements ContentList{
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
unitLand = new GroundEffect(30, e -> {
|
||||
Draw.color(Palette.lightishGray, e.color, e.rotation);
|
||||
Angles.randLenVectors(e.id, 6, 17f * e.finpow(), (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.3f);
|
||||
});
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
unitPickup = new GroundEffect(18, e -> {
|
||||
Draw.color(Palette.lightishGray);
|
||||
Lines.stroke(e.fin() * 2f);
|
||||
|
||||
@@ -27,9 +27,9 @@ import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.entities.EntityDraw;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.impl.BaseEntity;
|
||||
import io.anuke.ucore.entities.impl.EffectEntity;
|
||||
import io.anuke.ucore.entities.trait.DrawTrait;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.function.Predicate;
|
||||
@@ -88,8 +88,8 @@ public class Renderer extends RendererModule{
|
||||
entity.data = data;
|
||||
entity.id++;
|
||||
entity.set(x, y);
|
||||
if(data instanceof BaseEntity){
|
||||
entity.setParent((BaseEntity) data);
|
||||
if(data instanceof Entity){
|
||||
entity.setParent((Entity) data);
|
||||
}
|
||||
threads.runGraphics(() -> effectGroup.add(entity));
|
||||
}else{
|
||||
@@ -100,6 +100,9 @@ public class Renderer extends RendererModule{
|
||||
entity.id++;
|
||||
entity.data = data;
|
||||
entity.set(x, y);
|
||||
if(data instanceof Entity){
|
||||
entity.setParent((Entity) data);
|
||||
}
|
||||
threads.runGraphics(() -> groundEffectGroup.add(entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.fx.UnitFx;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
||||
import io.anuke.mindustry.entities.traits.*;
|
||||
@@ -19,16 +20,16 @@ import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Trail;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetConnection;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Mech;
|
||||
import io.anuke.mindustry.type.Upgrade;
|
||||
import io.anuke.mindustry.type.Weapon;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Floor;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock.CoreEntity;
|
||||
import io.anuke.mindustry.world.blocks.units.MechFactory;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
@@ -46,6 +47,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public static final int timerSync = 2;
|
||||
private static final int timerShootLeft = 0;
|
||||
private static final int timerShootRight = 1;
|
||||
private static final float liftoffBoost = 0.2f;
|
||||
|
||||
//region instance variables, constructor
|
||||
public float baseRotation;
|
||||
@@ -55,6 +57,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public String uuid, usid;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile;
|
||||
public float boostHeat;
|
||||
public boolean achievedFlight;
|
||||
public Color color = new Color();
|
||||
public Mech mech;
|
||||
public int spawner;
|
||||
@@ -195,7 +198,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
@Override
|
||||
public boolean isFlying(){
|
||||
return mech.flying || boostHeat > 0.2f || isCarried();
|
||||
return mech.flying || boostHeat > liftoffBoost || isCarried();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,8 +280,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
|
||||
}
|
||||
|
||||
boostHeat = Mathf.lerpDelta(boostHeat, isBoosting && ((!movement.isZero() && moved) || !isLocal) ? 1f : 0f, 0.08f);
|
||||
|
||||
float ft = Mathf.sin(walktime, 6f, 2f) * (1f - boostHeat);
|
||||
|
||||
Floor floor = getFloorOn();
|
||||
@@ -488,6 +489,17 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
protected void updateMech(){
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
boostHeat = Mathf.lerpDelta(boostHeat, isBoosting && ((!movement.isZero() && moved) || !isLocal) ? 1f : 0f, 0.08f);
|
||||
|
||||
if(boostHeat > liftoffBoost + 0.1f){
|
||||
achievedFlight = true;
|
||||
}
|
||||
|
||||
if(boostHeat <= liftoffBoost + 0.05f && achievedFlight){
|
||||
if(tile != null) Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
|
||||
achievedFlight = false;
|
||||
}
|
||||
|
||||
//if player is in solid block
|
||||
if(tile != null && tile.solid() && !isFlying()){
|
||||
damage(health + 1); //die instantly
|
||||
|
||||
@@ -24,7 +24,6 @@ public class Mech extends Upgrade implements UnlockableContent{
|
||||
public int drillPower = -1;
|
||||
public float carryWeight = 10f;
|
||||
public float buildPower = 1f;
|
||||
public boolean canRepair = false;
|
||||
public Color trailColor = Palette.boostFrom;
|
||||
public Color trailColorTo = Palette.boostTo;
|
||||
|
||||
|
||||
@@ -164,7 +164,6 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
graphics.checkPref("fps", false);
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("healthbars", true);
|
||||
graphics.checkPref("minimap", !mobile); //minimap is disabled by default on mobile devices
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user