Beispiel #1
0
    //Função que chama o evento para coletar energia
    public void GetEnergy(float energy)
    {
        _energy += energy;

        if (EnergyEvent != null)
        {
            EnergyEvent.Invoke(_energy / _maxEnergy);
        }
    }
 private void Start()
 {
     //Initializes the EnergyEvent instance
     //then sets the object attached to this script as
     //an invoker in the invoker list in the Event Manager
     maxEnergyEvent = new EnergyEvent();
     EventManager.SetChargeToMaxAddEventInvoker(this);
     EventManager.AddPlayerDeathListener(HandleSetGameIsFrozen);
 }
 public void SubscribeToEnergyCollectedEvent(EnergyEvent e)
 {
     EnergyCollectedEvent += e;
 }
 public void SubscribeToEnergyTierDecreasedEvent(EnergyEvent e)
 {
     EnergyTierDecreasedEvent += e;
 }