Two units complete

This commit is contained in:
Anuken
2022-05-01 14:49:30 -04:00
parent 41a8be1b29
commit 865a5d56ed
19 changed files with 182 additions and 70 deletions
@@ -0,0 +1,41 @@
package mindustry.entities.abilities;
import arc.graphics.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
public class MoveEffectAbility extends Ability{
public float minVelocity = 0.08f;
public float interval = 3f;
public float x, y;
public boolean rotateEffect = false;
public float effectParam = 3f;
public boolean teamColor = false;
public Color color = Color.white;
public Effect effect = Fx.missileTrail;
protected float counter;
public MoveEffectAbility(float x, float y, Color color, Effect effect, float interval){
this.x = x;
this.y = y;
this.color = color;
this.effect = effect;
this.interval = interval;
}
public MoveEffectAbility(){
}
@Override
public void update(Unit unit){
counter += Time.delta;
if(unit.vel.len2() >= minVelocity * minVelocity && (counter >= interval)){
Tmp.v1.trns(unit.rotation - 90f, x, y);
counter %= interval;
effect.at(Tmp.v1.x + unit.x, Tmp.v1.y + unit.y, rotateEffect ? unit.rotation : effectParam, teamColor ? unit.team.color : color);
}
}
}
@@ -151,7 +151,7 @@ public class BulletType extends Content implements Cloneable{
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f;
public @Nullable BulletType fragBullet = null;
public float bulletInterval = 20f;
public int intervalBulletCount = 1;
public int intervalBullets = 1;
public @Nullable BulletType intervalBullet;
public Color hitColor = Color.white;
public Color healColor = Pal.heal;
@@ -431,7 +431,7 @@ public class BulletType extends Content implements Cloneable{
public void updateBulletInterval(Bullet b){
if(intervalBullet != null && b.timer.get(2, bulletInterval)){
for(int i = 0; i < intervalBulletCount; i++){
for(int i = 0; i < intervalBullets; i++){
intervalBullet.create(b, b.x, b.y, Mathf.random(360f));
}
}
@@ -11,6 +11,7 @@ public class ShootBarrel extends ShootPattern{
barrels = barrels.clone();
for(int i = 0; i < barrels.length; i += 3){
barrels[i] *= -1;
barrels[i + 2] *= -1;
}
}
@@ -10,7 +10,7 @@ public class ShootHelix extends ShootPattern{
for(int i = 0; i < shots; i++){
for(int sign : Mathf.signs){
handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i,
b -> b.moveRelative(0f, Mathf.sin(b.time + offset, 2f, mag * sign)));
b -> b.moveRelative(0f, Mathf.sin(b.time + offset, scl, mag * sign)));
}
}
}
@@ -29,9 +29,9 @@ public class ShootMulti extends ShootPattern{
source.shoot(totalShots, (x, y, rotation, delay, move) -> {
for(var pattern : dest){
pattern.shoot(totalShots, (x2, y2, rot2, delay2, mover) -> {
handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2, b -> {
move.move(b);
mover.move(b);
handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2, move == null && mover == null ? null : b -> {
if(move != null) move.move(b);
if(mover != null) mover.move(b);
});
});
}