HKMBFZ/Assets/Scripts/Szz_Scripts/Machine/LightState.cs

25 lines
473 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LightState : MonoBehaviour
{
public Renderer targetMesh;
private void Start()
{
if (targetMesh == null)
targetMesh = GetComponent<Renderer>();
}
public void OpenLight()
{
targetMesh.material.EnableKeyword("_EMISSION");
}
public void CloseLight()
{
targetMesh.material.DisableKeyword("_EMISSION");
}
}