41 lines
839 B
C#
41 lines
839 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting.Antlr3.Runtime;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Control_Tv : MonoBehaviour
|
|
{
|
|
public static Control_Tv Instance;
|
|
|
|
public Button OpenTv;
|
|
|
|
public Transform Tv;
|
|
|
|
bool isopen = false;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
void Start()
|
|
{
|
|
OpenTv.onClick.AddListener(() =>
|
|
{
|
|
isopen = !isopen;
|
|
OpenTvs(isopen);
|
|
});
|
|
}
|
|
|
|
public void OpenTvs(bool Isopen)
|
|
{
|
|
if (Isopen)
|
|
{
|
|
Tv.GetChild(0).GetComponent<MeshRenderer>().materials[0].EnableKeyword("_EMISSION");
|
|
}
|
|
else
|
|
{
|
|
Tv.GetChild(0).GetComponent<MeshRenderer>().materials[0].DisableKeyword("_EMISSION");
|
|
}
|
|
}
|
|
}
|