mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-10 04:53:41 +00:00
25 lines
556 B
C#
25 lines
556 B
C#
|
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);
|
|||
|
}
|
|||
|
}
|