mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-10 12:53:43 +00:00
35 lines
708 B
C#
35 lines
708 B
C#
|
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;
|
||
|
|
||
|
private void OnCollisionEnter(Collision collision)
|
||
|
{
|
||
|
var rb = collision.rigidbody;
|
||
|
|
||
|
if (!rb)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
//enteredBodies.Add(rb);
|
||
|
|
||
|
if (rb.GetComponent<DefectiveProduct>())
|
||
|
{
|
||
|
defectiveProductCount++;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
normalProductCount++;
|
||
|
}
|
||
|
|
||
|
Destroy(rb.gameObject);
|
||
|
}
|
||
|
}
|