LaboratoryProtection/Assets/UnityTest/ZXL/Scripts/ObjectDataComponent.cs

43 lines
1.0 KiB
C#
Raw Normal View History

2023-09-13 02:20:37 +08:00
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace UnityTest.ZXL
{
2023-09-13 20:15:22 +08:00
public class ObjectDataComponent : BaseAutoMono<ObjectDataComponent>
2023-09-13 02:20:37 +08:00
{
2023-09-13 15:04:19 +08:00
public List<ObjectData> objectData = new List<ObjectData>();
2023-09-13 20:15:22 +08:00
2023-09-13 15:04:19 +08:00
public List<ObjectData> highlightObjectData = new List<ObjectData>();
2023-09-13 20:15:22 +08:00
public Dictionary<string, ObjectComponent> objectComponents = new Dictionary<string, ObjectComponent>();
public GameObject GetObject(HighlightObjectType objectType)
{
var key = objectType.ToString();
if (objectComponents.TryGetValue(key, out ObjectComponent component))
{
return component.gameObject;
}
return null;
}
2023-09-13 02:20:37 +08:00
}
[System.Serializable]
2023-09-13 15:04:19 +08:00
public struct ObjectData
2023-09-13 02:20:37 +08:00
{
2023-09-13 15:04:19 +08:00
public string goName;
public GameObject go;
2023-09-13 02:20:37 +08:00
}
2023-09-13 09:28:54 +08:00
2023-09-13 20:15:22 +08:00
public enum HighlightObjectType
2023-09-13 09:28:54 +08:00
{
,
,
湿,
,
,
}
2023-09-13 02:20:37 +08:00
}