LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/PowerSwitchable.cs
2023-12-22 18:30:10 -05:00

23 lines
521 B
C#

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);
}
}