From 90285f75eb67e0576615807fbbdb413211bd06a8 Mon Sep 17 00:00:00 2001 From: teascade Date: Sun, 18 Aug 2019 19:44:26 +0300 Subject: [PATCH] Fix BulletHole position flipping --- Assets/Scripts/Guns/Gun.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Assets/Scripts/Guns/Gun.cs b/Assets/Scripts/Guns/Gun.cs index eaaf61d..ce1c4a7 100644 --- a/Assets/Scripts/Guns/Gun.cs +++ b/Assets/Scripts/Guns/Gun.cs @@ -20,6 +20,12 @@ namespace Saltosion.OneWeapon.Guns { private Bullet CurrentBullet; private bool HasShotBullet = false; + private float BulletHoleOriginalY; + + void Start() { + BulletHoleOriginalY = BulletHole.localPosition.y; + } + void Update() { if (CurrCooldown > 0) { CurrCooldown -= Time.deltaTime; @@ -66,6 +72,11 @@ namespace Saltosion.OneWeapon.Guns { public void FlipGun(bool flipped) { Sprite.flipY = flipped; + float y = BulletHoleOriginalY; + if (flipped) { + y = -y; + } + BulletHole.localPosition = new Vector2(BulletHole.localPosition.x, y); } } }