quality-control/Assets/Scripts/Interactable/HammerableRigidbody.cs

25 lines
556 B
C#
Raw Normal View History

2024-08-18 15:48:35 +00:00
using Nothke.Interaction;
using Nothke.Interaction.Items;
using UnityEngine;
public class HammerableRigidbody: RigidbodyInteractable
{
public override void Use(InteractionController im)
{
if (im.hands.item == null)
{
base.Use(im);
return;
}
var product = GetComponentInChildren<Product>();
if (!product)
{
return;
}
var clip = product.Type.SelectClip(product.Defect != DefectType.None);
NAudio.Play(clip, transform.position);
}
}