quality-control/Assets/Scripts/Machines/ProductReceiver.cs

31 lines
716 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProductReceiver : MonoBehaviour
{
///HashSet<Rigidbody> enteredBodies = new HashSet<Rigidbody>();
public int normalProductCount;
public int defectiveProductCount;
2024-08-18 15:48:35 +00:00
private void OnTriggerEnter(Collider otherCollider)
{
2024-08-18 15:48:35 +00:00
var product = otherCollider.GetComponentInParent<Product>();
2024-08-18 15:48:35 +00:00
if (product != null)
{
if (product.Defect != DefectType.None)
{
defectiveProductCount++;
}
else
{
normalProductCount++;
}
2024-08-18 15:48:35 +00:00
Destroy(product.gameObject);
}
}
}