Weapon layerOffset

This commit is contained in:
Anuken
2021-10-27 15:51:46 -04:00
parent a441c0bdcb
commit be5c46beb8

View File

@@ -97,6 +97,8 @@ public class Weapon implements Cloneable{
public boolean parentizeEffects; public boolean parentizeEffects;
/** internal value used for alternation - do not change! */ /** internal value used for alternation - do not change! */
public int otherSide = -1; public int otherSide = -1;
/** draw Z offset relative to the default value */
public float layerOffset = 0f;
/** sound used for shooting */ /** sound used for shooting */
public Sound shootSound = Sounds.pew; public Sound shootSound = Sounds.pew;
/** sound used for weapons that have a delay */ /** sound used for weapons that have a delay */
@@ -161,6 +163,10 @@ public class Weapon implements Cloneable{
} }
public void draw(Unit unit, WeaponMount mount){ public void draw(Unit unit, WeaponMount mount){
//apply layer offset, roll it back at the end
float z = Draw.z();
Draw.z(z + layerOffset);
float float
rotation = unit.rotation - 90, rotation = unit.rotation - 90,
weaponRotation = rotation + (rotate ? mount.rotation : 0), weaponRotation = rotation + (rotate ? mount.rotation : 0),
@@ -196,6 +202,8 @@ public class Weapon implements Cloneable{
Draw.blend(); Draw.blend();
Draw.color(); Draw.color();
} }
Draw.z(z);
} }
public void update(Unit unit, WeaponMount mount){ public void update(Unit unit, WeaponMount mount){