mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-10 04:53:41 +00:00
29 lines
630 B
C#
29 lines
630 B
C#
using Nothke.Interaction;
|
|
using Nothke.Interaction.Items;
|
|
using UnityEngine;
|
|
|
|
public class HammerableRigidbody: RigidbodyInteractable
|
|
{
|
|
public override void Use(InteractionController im)
|
|
{
|
|
manager = 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);
|
|
clip.Play(
|
|
transform.position,
|
|
Random.Range(0.8f, 1.2f));
|
|
}
|
|
} |