first commit
This commit is contained in:
28
Assets/Scripts/Asrtronaut/PlanetDropdown.cs
Normal file
28
Assets/Scripts/Asrtronaut/PlanetDropdown.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class PlanetDropdown : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_Dropdown _dropdown;
|
||||
[SerializeField] private PlanetWeight.PlanetName _planet;
|
||||
[SerializeField] private TextMeshProUGUI _planetNameText;
|
||||
|
||||
public TMP_Dropdown Dropdown => _dropdown;
|
||||
public int PlanetIndex => (int)_planet;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (_planetNameText != null)
|
||||
_planetNameText.text = _planet.ToString();
|
||||
|
||||
_dropdown.onValueChanged.AddListener(OnValueChanged);
|
||||
}
|
||||
|
||||
void OnValueChanged(int index)
|
||||
{
|
||||
if (_planetNameText != null)
|
||||
_planetNameText.text = _planet.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user