2024-08-18 12:44:44 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2024-08-18 15:48:35 +00:00
|
|
|
|
public class DefectMaterialVisualizer : MonoBehaviour, IDefectVisualizer
|
2024-08-18 12:44:44 +00:00
|
|
|
|
{
|
|
|
|
|
public MeshRenderer MeshRenderer;
|
2024-08-18 15:48:35 +00:00
|
|
|
|
|
2024-08-18 12:44:44 +00:00
|
|
|
|
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,
|
|
|
|
|
};
|
2024-08-18 15:48:35 +00:00
|
|
|
|
|
2024-08-18 12:44:44 +00:00
|
|
|
|
public void VisualizeDefect(DefectType defectType)
|
|
|
|
|
{
|
2024-08-18 15:48:35 +00:00
|
|
|
|
var materials = MeshRenderer.sharedMaterials;
|
|
|
|
|
|
2024-08-18 12:44:44 +00:00
|
|
|
|
for (var i = 0; i < supportedDefects.Count; i++)
|
|
|
|
|
{
|
2024-08-18 15:48:35 +00:00
|
|
|
|
if (defectType.HasFlag(supportedDefects[i]))
|
2024-08-18 12:44:44 +00:00
|
|
|
|
{
|
2024-08-18 15:48:35 +00:00
|
|
|
|
materials[i + 1] = null;
|
2024-08-18 12:44:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-18 15:48:35 +00:00
|
|
|
|
|
|
|
|
|
MeshRenderer.sharedMaterials = materials;
|
2024-08-18 12:44:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|