private IEnumerator Restoring() { yield return(new WaitForSeconds(_restoringDelay)); while (_currentEnergy < _maxEnergy) { _currentEnergy++; EnergyChanged?.Invoke(_currentEnergy, _maxEnergy); yield return(new WaitForSeconds(_restoringRate)); } }
private IEnumerator Shooting() { while (CanShoot) { _guns[_gunIndex].Shoot(_shotPrefab, _shotAudio); _currentEnergy--; IncreaseCanonIndex(); EnergyChanged?.Invoke(_currentEnergy, _maxEnergy); yield return(new WaitForSeconds(_fireRate)); } }
protected virtual void OnEnergyChanged(EnergyEventArgs e) { EnergyChanged?.Invoke(this, e); }
public void ChangeEnergy(int energyDelta) { CurrentEnergy = Mathf.Clamp(CurrentEnergy + energyDelta, 0, maxEnergy); OnEnergyChanged.Invoke(); EnergyChanged?.Invoke(CurrentEnergy); }
private void Start() { _currentEnergy = _maxEnergy; StartRestore(); EnergyChanged?.Invoke(_currentEnergy, _maxEnergy); }
private void OnPlayerChangeFlightEnergy(S_PLAYER_CHANGE_FLIGHT_ENERGY m) { EnergyChanged?.Invoke(m.Energy); }