SHADE_Y3/Assets/Scripts/Gameplay/Item/SC_Item.cs

44 lines
827 B
C#
Raw Normal View History

using SHADE;
using System;
public class Item : Script
{
public enum ItemCategory
{
LIGHT,
MEDIUM,
HEAVY
}
public int Score = 10;
public ItemCategory currCategory;
private RigidBody rb;
2022-11-21 21:01:44 +08:00
private bool once = false;
protected override void awake()
{
rb = GetComponent<RigidBody>();
}
protected override void update()
{
}
2022-11-21 21:01:44 +08:00
protected override void onCollisionEnter(CollisionInfo info)
{
2022-11-21 21:01:44 +08:00
if (once)
{
if(currCategory == ItemCategory.LIGHT)
2022-11-23 00:44:27 +08:00
Audio.PlaySFXOnce2D("event:/Props/impact_elastic");
2022-11-21 21:01:44 +08:00
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
2022-11-23 00:44:27 +08:00
Audio.PlaySFXOnce2D("event:/Props/impact_hard");
2022-11-21 21:01:44 +08:00
once = false;
}
}
protected override void onCollisionExit(CollisionInfo info)
{
once = true;
}
}