1
0
Fork 0
LaboratoryProtection/Assets/UnityTest/ZXL/Scripts/Test/CharacterInfo.cs

53 lines
1.1 KiB
C#
Raw Normal View History

2023-09-24 11:28:47 +08:00
using System.Collections.Generic;
using UnityEngine;
namespace UnityTest.ZXL
{
public class CharacterInfo : MonoBehaviour
{
[SerializeField] private ClothingType clothingType;
[SerializeField] private List<ClothingData> list = new List<ClothingData>();
public void SetCloth(string str)
{
ClothingData go = null;
foreach (var data in list)
{
if (data.name == str)
{
go = data;
}
}
if (go != null)
{
foreach (var clothingData in list)
{
clothingData.go.SetActive(false);
}
go.go.SetActive(true);
}
else
{
Debug.LogError($"the info dont have {str}");
}
}
}
[System.Serializable]
public class ClothingData
{
public string name;
public GameObject go;
}
public enum ClothingType
{
,
,
,
,
,
}
}