changes breakable to only minus count on items

This commit is contained in:
Glence 2023-02-02 11:16:56 +08:00
parent aaf4919c27
commit 5b628baedf
1 changed files with 5 additions and 2 deletions

View File

@ -47,6 +47,7 @@ public class Breakable : Script
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold)
{
isBreak = true;
if(GameObject.GetScript<Item>())
GameManager.Instance.totalItemCount -= 1;
}
}
@ -61,12 +62,14 @@ public class Breakable : Script
{
item.SetActive(true);
item.GetComponent<Transform>().GlobalPosition = trans.LocalPosition + item.GetComponent<Transform>().LocalPosition;
if (item.GetScript<Item>())
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);
}
}