Electricity Changed

public event PlayerElectricityChanged ElectricityChanged

Event fired when the player’s electricity (used or total) is changed. Keep in mind that this works for any ingame player, even AI.

To subscribe to the local player event, do:

[Inject] PlayersService players;

void Start()
{
  players.LocalPlayer.ElectricityChanged += OnPlayerElectricityChanged;
}

void OnPlayerElectricityChanged(int totalElectricity, int usedElectricity)
{
  // your actions
}