mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-14 14:43:43 +00:00
31 lines
842 B
C#
31 lines
842 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DefectMaterialVisualizer : MonoBehaviour, IDefectVisualizer
|
|
{
|
|
public MeshRenderer MeshRenderer;
|
|
|
|
private List<DefectType> supportedDefects = new()
|
|
{
|
|
DefectType.Hex_MissingMaterial_1,
|
|
DefectType.Hex_MissingMaterial_2,
|
|
DefectType.Hex_MissingMaterial_3,
|
|
DefectType.Hex_MissingMaterial_4,
|
|
DefectType.Hex_MissingMaterial_5,
|
|
};
|
|
|
|
public void VisualizeDefect(DefectType defectType)
|
|
{
|
|
var materials = MeshRenderer.sharedMaterials;
|
|
|
|
for (var i = 0; i < supportedDefects.Count; i++)
|
|
{
|
|
if (defectType.HasFlag(supportedDefects[i]))
|
|
{
|
|
materials[i + 1] = null;
|
|
}
|
|
}
|
|
|
|
MeshRenderer.sharedMaterials = materials;
|
|
}
|
|
} |