Moved bullet FX to ammo type, beginning of weapon rework

This commit is contained in:
Anuken
2018-04-23 21:35:40 -04:00
parent 19d058a644
commit 8581213126
16 changed files with 311 additions and 275 deletions
@@ -1,7 +1,9 @@
package io.anuke.mindustry.resource;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.BulletType;
import io.anuke.ucore.core.Effects.Effect;
public class AmmoType {
private static int lastID = 0;
@@ -17,8 +19,12 @@ public class AmmoType {
/**For item ammo, this is amount given per ammo item.
* For liquid ammo, this is amount used per shot.*/
public final float quantityMultiplier;
/**Turret shoot speed multiplier.*/
public final float speedMultiplier;
/**Reload speed multiplier.*/
public float speedMultiplier = 1f;
/**Effect created when shooting.*/
public Effect shootEffect = Fx.none;
/**Extra smoke effect created when shooting.*/
public Effect smokeEffect = Fx.none;
{
this.id = (byte)(lastID++);
@@ -33,20 +39,18 @@ public class AmmoType {
this.speedMultiplier = 1f;
}
public AmmoType(Item item, BulletType result, float multiplier, float speedMultiplier){
public AmmoType(Item item, BulletType result, float multiplier){
this.item = item;
this.liquid = null;
this.bullet = result;
this.quantityMultiplier = multiplier;
this.speedMultiplier = speedMultiplier;
}
public AmmoType(Liquid liquid, BulletType result, float multiplier, float speedMultiplier){
public AmmoType(Liquid liquid, BulletType result, float multiplier){
this.item = null;
this.liquid = liquid;
this.bullet = result;
this.quantityMultiplier = multiplier;
this.speedMultiplier = speedMultiplier;
}
public static Array<AmmoType> getAllTypes() {
@@ -1,8 +1,6 @@
package io.anuke.mindustry.resource;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Bullet;
import io.anuke.mindustry.entities.BulletType;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.net.Net;
@@ -16,8 +14,6 @@ import io.anuke.ucore.util.Translator;
public class Weapon extends Upgrade{
/**weapon reload in frames*/
protected float reload;
/**type of bullet shot*/
protected BulletType type;
/**sound made when shooting*/
protected String shootsound = "shoot";
/**amount of shots per fire*/
@@ -37,10 +33,9 @@ public class Weapon extends Upgrade{
/**translator for vector calulations*/
protected Translator tr = new Translator();
protected Weapon(String name, float reload, BulletType type){
protected Weapon(String name, float reload){
super(name);
this.reload = reload;
this.type = type;
}
public void update(Player p, boolean left){
@@ -78,7 +73,7 @@ public class Weapon extends Upgrade{
void bullet(Unit owner, float x, float y, float angle){
tr.trns(angle, 3f);
Bullet.create(type, owner, x + tr.x, y + tr.y, angle);
//TODO implement!
//Bullet.create(type, owner, x + tr.x, y + tr.y, angle);
}
}