2026-04-22 모듈러 에셋 포함
This commit is contained in:
47
Assets/BoZo_ModularAnimeCharacters/Scripts/OutfitSelector.cs
Normal file
47
Assets/BoZo_ModularAnimeCharacters/Scripts/OutfitSelector.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Bozo.AnimeCharacters
|
||||
{
|
||||
public class OutfitSelector : MonoBehaviour
|
||||
{
|
||||
public Image icon;
|
||||
private Outfit outfit;
|
||||
private CharacterCreator characterCreator;
|
||||
private Button button;
|
||||
public void Init(Outfit outfit, CharacterCreator characterCreator)
|
||||
{
|
||||
//icon = GetComponentInChildren<Image>();
|
||||
button = GetComponentInChildren<Button>();
|
||||
button.onClick.AddListener(OnSelect);
|
||||
|
||||
this.outfit = outfit;
|
||||
this.characterCreator = characterCreator;
|
||||
icon.overrideSprite = this.outfit.OutfitIcon;
|
||||
}
|
||||
|
||||
private void OnSelect()
|
||||
{
|
||||
characterCreator.SetOutfit(outfit);
|
||||
}
|
||||
|
||||
public void SetVisable(string type)
|
||||
{
|
||||
if (outfit.Type == null)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
Debug.LogWarning(outfit.name + " is missing an outfitType and will not show in the character creator");
|
||||
return;
|
||||
}
|
||||
|
||||
if(outfit.Type.name == type)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user