diff --git a/Assets/Scripts/Gameplay/Item/SC_Breakable.cs b/Assets/Scripts/Gameplay/Item/SC_Breakable.cs index 14ee4477..964a8b99 100644 --- a/Assets/Scripts/Gameplay/Item/SC_Breakable.cs +++ b/Assets/Scripts/Gameplay/Item/SC_Breakable.cs @@ -47,7 +47,8 @@ public class Breakable : Script if (rb.LinearVelocity.GetSqrMagnitude() > threshHold) { isBreak = true; - GameManager.Instance.totalItemCount -= 1; + if(GameObject.GetScript()) + GameManager.Instance.totalItemCount -= 1; } } protected override void onTriggerEnter(CollisionInfo info) @@ -61,12 +62,14 @@ public class Breakable : Script { item.SetActive(true); item.GetComponent().GlobalPosition = trans.LocalPosition + item.GetComponent().LocalPosition; + if (item.GetScript()) + GameManager.Instance.totalItemCount += 1; GameObject gO = item; gO.Parent = GameObject.Null; } isBreak = false; Audio.PlaySFXOnce2D("event:/Props/impact_break"); - Owner.SetActive(false); + GameObject.SetActive(false); } } \ No newline at end of file