Bullet parts / Improved clipping in #7282
This commit is contained in:
@@ -14,6 +14,7 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.part.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -190,6 +191,8 @@ public class BulletType extends Content implements Cloneable{
|
||||
public int despawnUnitCount = 1;
|
||||
/** Random offset distance from the original bullet despawn/hit coordinate. */
|
||||
public float despawnUnitRadius = 0.1f;
|
||||
/** Extra visual parts for this bullet. */
|
||||
public Seq<DrawPart> parts = new Seq<>();
|
||||
|
||||
/** Color of trail behind bullet. */
|
||||
public Color trailColor = Pal.missileYellowBack;
|
||||
@@ -481,6 +484,7 @@ public class BulletType extends Content implements Cloneable{
|
||||
|
||||
public void draw(Bullet b){
|
||||
drawTrail(b);
|
||||
drawParts(b);
|
||||
}
|
||||
|
||||
public void drawTrail(Bullet b){
|
||||
@@ -493,6 +497,17 @@ public class BulletType extends Content implements Cloneable{
|
||||
}
|
||||
}
|
||||
|
||||
public void drawParts(Bullet b){
|
||||
if(parts.size > 0){
|
||||
DrawPart.params.set(b.fin(), 0f, 0f, 0f, 0f, 0f, b.x, b.y, b.rotation());
|
||||
DrawPart.params.life = b.fin();
|
||||
|
||||
for(int i = 0; i < parts.size; i++){
|
||||
parts.get(i).draw(DrawPart.params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLight(Bullet b){
|
||||
if(lightOpacity <= 0f || lightRadius <= 0f) return;
|
||||
Drawf.light(b, lightRadius, lightColor, lightOpacity);
|
||||
|
||||
Reference in New Issue
Block a user