LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/PowerSwitchable.cs

24 lines
521 B
C#
Raw Normal View History

2023-12-22 22:51:17 +00:00
using UnityEngine;
public class PowerSwitchable : MonoBehaviour
{
public OnSwitchPowerEvent powerSwitchEvent;
public void OnPowerSwitch(bool switchedOn)
{
Debug.Log("Power switched event invoked by powerswitchable");
powerSwitchEvent.Invoke(switchedOn);
}
private void OnEnable()
{
RoundManager.Instance.onPowerSwitch.AddListener(OnPowerSwitch);
Debug.Log("Added listener to power switch event");
}
private void OnDisable()
{
RoundManager.Instance.onPowerSwitch.RemoveListener(OnPowerSwitch);
}
}