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

44 lines
827 B
C#

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