Scripting changes for item and added level 1 scene #330

Merged
glencelow merged 10 commits from PlayerController into main 2023-02-02 11:20:20 +08:00
1 changed files with 5 additions and 2 deletions
Showing only changes of commit 5b628baedf - Show all commits

View File

@ -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);
}
}