Ejemplo n.º 1
0
 private void SetEnergy(float value)
 {
     _energy = value;
     if (OnEnergyChange != null)
     {
         OnEnergyChange.Invoke(_energy);
     }
 }
Ejemplo n.º 2
0
 private void RegenerateEnergy()
 {
     if (_energy < _maxEnergy)
     {
         _energy += Time.deltaTime;
         OnEnergyChange?.Invoke(_energy / _maxEnergy);
     }
 }
Ejemplo n.º 3
0
 public void ChangeGravityImmediantely()
 {
     if (_energy > .5f * _maxEnergy)
     {
         _energy = 0;
         OnEnergyChange?.Invoke(_energy / _maxEnergy);
         Physics.gravity *= -1;
     }
 }
Ejemplo n.º 4
0
 public void ReduceEnergy(float damage)
 {
     if (damage <= 1)
     {
         _energy -= damage;
     }
     if (_energy <= 0)
     {
         Location.Instance.Restart();
         _energy = StartEnergy;
     }
     if (OnEnergyChange != null)
     {
         OnEnergyChange.Invoke(_energy);
     }
 }
Ejemplo n.º 5
0
    public void Init()
    {
        _status = new GameStatus();

        // Proxy the status event
        _status.OnGameTimeChange          += (value, diff) => { OnGameTimeChange?.Invoke(value, diff); };
        _status.OnLocationChange          += (value, prev) => { OnLocationChange?.Invoke(value, prev); };
        _status.OnCareerChange            += (value, diff) => { OnCareerChange?.Invoke(value, diff); };
        _status.OnMoneyChange             += (value, diff) => { OnMoneyChange?.Invoke(value, diff); };
        _status.OnEnergyChange            += (value, diff) => { OnEnergyChange?.Invoke(value, diff); };
        _status.OnPersonalHappinessChange += (value, diff) => { OnPersonalHappinessChange?.Invoke(value, diff); };
        _status.OnFamilyHappinessChange   += (value, diff) => { OnFamilyHappinessChange?.Invoke(value, diff); };
        _status.OnProjectProgressChange   += (value, diff) => { OnProjectProgressChange?.Invoke(value, diff); };

        View.Init();
        View.UpdateUI();
        UpdateUI();
    }