Reworking item spawn, adding item conversion.

This commit is contained in:
Khauvinkh
2024-08-18 14:44:44 +02:00
parent d2c3dff101
commit 683f839905
50 changed files with 2219 additions and 766 deletions

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class DefectMeshSelector: MonoBehaviour, IDefectVisualizer
{
public GameObject NormalPrefab;
[Serializable]
public struct PrefabVariant
{
public DefectType DefectType;
public GameObject Prefab;
}
public List<PrefabVariant> DefectivePrefabVariants;
public void VisualizeDefect(DefectType defectType)
{
if (defectType == DefectType.None)
{
NormalPrefab.SetActive(true);
foreach (var variant in DefectivePrefabVariants)
{
variant.Prefab.SetActive(false);
}
}
else
{
NormalPrefab.SetActive(false);
foreach (var variant in DefectivePrefabVariants)
{
variant.Prefab.SetActive(false);
if (defectType.HasFlag(variant.DefectType))
{
variant.Prefab.SetActive(true);
return;
}
}
}
}
}