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

20 lines
449 B
C#
Raw Permalink Normal View History

2024-08-18 15:48:35 +00:00
using Nothke.Interaction;
using Nothke.Interaction.Items;
using UnityEngine;
2024-08-19 22:20:33 +00:00
public class HammerableRigidbody : RigidbodyInteractable
2024-08-18 15:48:35 +00:00
{
2024-08-19 22:20:33 +00:00
public void Hammer()
2024-08-18 15:48:35 +00:00
{
var product = GetComponentInChildren<Product>();
if (!product)
return;
var clip = product.Type.SelectClip(product.Defect != DefectType.None);
2024-08-19 22:20:33 +00:00
2024-08-18 22:26:03 +00:00
clip.Play(
transform.position,
Random.Range(0.8f, 1.2f));
2024-08-18 15:48:35 +00:00
}
}