Fix BulletHole position flipping

This commit is contained in:
Sofia 2019-08-18 19:44:26 +03:00
parent 1ac0fedddf
commit 90285f75eb

View File

@ -20,6 +20,12 @@ namespace Saltosion.OneWeapon.Guns {
private Bullet CurrentBullet; private Bullet CurrentBullet;
private bool HasShotBullet = false; private bool HasShotBullet = false;
private float BulletHoleOriginalY;
void Start() {
BulletHoleOriginalY = BulletHole.localPosition.y;
}
void Update() { void Update() {
if (CurrCooldown > 0) { if (CurrCooldown > 0) {
CurrCooldown -= Time.deltaTime; CurrCooldown -= Time.deltaTime;
@ -66,6 +72,11 @@ namespace Saltosion.OneWeapon.Guns {
public void FlipGun(bool flipped) { public void FlipGun(bool flipped) {
Sprite.flipY = flipped; Sprite.flipY = flipped;
float y = BulletHoleOriginalY;
if (flipped) {
y = -y;
}
BulletHole.localPosition = new Vector2(BulletHole.localPosition.x, y);
} }
} }
} }