2022-11-04 17:31:53 +08:00
|
|
|
|
using SHADE;
|
|
|
|
|
using System;
|
|
|
|
|
public class Item : Script
|
|
|
|
|
{
|
|
|
|
|
public enum ItemCategory
|
|
|
|
|
{
|
|
|
|
|
LIGHT,
|
|
|
|
|
MEDIUM,
|
|
|
|
|
HEAVY
|
|
|
|
|
}
|
2022-11-17 12:54:08 +08:00
|
|
|
|
|
2022-11-17 00:23:38 +08:00
|
|
|
|
public int Score = 10;
|
2022-11-04 17:31:53 +08:00
|
|
|
|
|
|
|
|
|
public ItemCategory currCategory;
|
2022-11-20 16:27:39 +08:00
|
|
|
|
private RigidBody rb;
|
2022-11-21 21:01:44 +08:00
|
|
|
|
private bool once = false;
|
2022-11-04 17:31:53 +08:00
|
|
|
|
|
|
|
|
|
protected override void awake()
|
|
|
|
|
{
|
2022-11-20 16:27:39 +08:00
|
|
|
|
rb = GetComponent<RigidBody>();
|
2022-11-25 16:23:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void update()
|
|
|
|
|
{
|
2022-11-04 17:31:53 +08:00
|
|
|
|
}
|
2022-11-17 12:54:08 +08:00
|
|
|
|
|
2022-11-21 21:01:44 +08:00
|
|
|
|
protected override void onCollisionEnter(CollisionInfo info)
|
2022-11-17 12:54:08 +08:00
|
|
|
|
{
|
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;
|
2022-11-17 12:54:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-04 17:31:53 +08:00
|
|
|
|
}
|