Interactable Class

This commit is contained in:
DerTyp187
2021-09-23 20:09:12 +02:00
parent c268d0c489
commit 904b534695
331 changed files with 59287 additions and 7 deletions

View File

@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LightSwitch : Interactable
{
public Light m_Light;
public bool isOn;
private void Start()
{
UpdateLight();
}
private void UpdateLight()
{
m_Light.enabled = isOn;
}
public override string GetDescription()
{
if (isOn)
{
return "Press [E] to turn <color=red>off</color> the light.";
}
return "Press [E] to turn <color=green>on</color> the light.";
}
public override void Interact()
{
isOn = !isOn;
Debug.Log("Click Light");
UpdateLight();
}
}