changes breakable to only minus count on items
This commit is contained in:
parent
aaf4919c27
commit
5b628baedf
|
@ -47,7 +47,8 @@ public class Breakable : Script
|
||||||
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold)
|
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold)
|
||||||
{
|
{
|
||||||
isBreak = true;
|
isBreak = true;
|
||||||
GameManager.Instance.totalItemCount -= 1;
|
if(GameObject.GetScript<Item>())
|
||||||
|
GameManager.Instance.totalItemCount -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override void onTriggerEnter(CollisionInfo info)
|
protected override void onTriggerEnter(CollisionInfo info)
|
||||||
|
@ -61,12 +62,14 @@ public class Breakable : Script
|
||||||
{
|
{
|
||||||
item.SetActive(true);
|
item.SetActive(true);
|
||||||
item.GetComponent<Transform>().GlobalPosition = trans.LocalPosition + item.GetComponent<Transform>().LocalPosition;
|
item.GetComponent<Transform>().GlobalPosition = trans.LocalPosition + item.GetComponent<Transform>().LocalPosition;
|
||||||
|
if (item.GetScript<Item>())
|
||||||
|
GameManager.Instance.totalItemCount += 1;
|
||||||
GameObject gO = item;
|
GameObject gO = item;
|
||||||
gO.Parent = GameObject.Null;
|
gO.Parent = GameObject.Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isBreak = false;
|
isBreak = false;
|
||||||
Audio.PlaySFXOnce2D("event:/Props/impact_break");
|
Audio.PlaySFXOnce2D("event:/Props/impact_break");
|
||||||
Owner.SetActive(false);
|
GameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue