23 lines
521 B
C#
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);
|
|
}
|
|
}
|