UnityGameProjectsCode / InTheDarkGame / ButtonFunctions.cs
ButtonFunctions.cs
Raw
using UnityEngine;
using UnityEngine.UI;

public class ButtonFunctions : MonoBehaviour
{
    public GameObject blocker;
    public GameObject levelText;
    private AudioSource uiSound;
    public GameObject fullLevelNameText;

    public void DisableBlocker()
    {
        uiSound = GetComponent<AudioSource>();
        GetComponent<Button>().interactable = true;
        blocker.SetActive(false);
        levelText.SetActive(true);
    }

    public void EnableBlocker()
    {
        GetComponent<Button>().interactable = false;
        blocker.SetActive(true);
        levelText.SetActive(false);
    }

    public void OnMoveOver(bool state)
    {
        if(!blocker.activeSelf)
        {
            if (state)
            {
                fullLevelNameText.SetActive(true);
                uiSound.Play();
            }
            else
            {
                fullLevelNameText.SetActive(false);
            }
        }

    }

}