Scripting changes for item and added level 1 scene #330
|
@ -47,7 +47,8 @@ public class Breakable : Script
|
|||
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold)
|
||||
{
|
||||
isBreak = true;
|
||||
GameManager.Instance.totalItemCount -= 1;
|
||||
if(GameObject.GetScript<Item>())
|
||||
GameManager.Instance.totalItemCount -= 1;
|
||||
}
|
||||
}
|
||||
protected override void onTriggerEnter(CollisionInfo info)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue