35 lines
1016 B
C#
35 lines
1016 B
C#
using RTLTMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class MicManager : MonoBehaviour
|
|
{
|
|
public Sprite[] sprites;
|
|
|
|
public string[] descriptions;
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
SetMic();
|
|
|
|
}
|
|
public RTLTextMeshPro description;
|
|
public Image icon;
|
|
// Update is called once per frame
|
|
public void Change()
|
|
{
|
|
playerManager.instance.selectedMic++;
|
|
if (playerManager.instance.selectedMic == 3)
|
|
playerManager.instance.selectedMic = 0;
|
|
SetMic();
|
|
}
|
|
public void SetMic()
|
|
{
|
|
description.text = descriptions[playerManager.instance.selectedMic];
|
|
icon.sprite = sprites[playerManager.instance.selectedMic];
|
|
PlayerPrefs.SetInt("Mic", playerManager.instance.selectedMic);
|
|
icon.color = playerManager.instance.selectedMic == 0 ? Color.green : playerManager.instance.selectedMic == 1 ? Color.white : Color.gray;
|
|
|
|
}
|
|
}
|