private void SetStats(StatsEffect effect) { PlayerStatsDict.Instance.NormalizeStats(ref effect); if (effect.health != health) { health = effect.health; player.Health.SetMax(PlayerStatsDict.Instance.GetHealth(health)); OnHealthChanged?.Invoke(health); } if (effect.speed != speed) { speed = effect.speed; OnSpeedChanged?.Invoke(speed); } if (effect.luck != luck) { luck = effect.luck; OnLuckChanged?.Invoke(luck); } if (effect.dodge != dodge) { dodge = effect.dodge; OnDodgeChanged?.Invoke(dodge); } }
public void NextSpeed() { currentState++; if (currentState >= speedStates.Count) { currentState = 0; } level.SetSpeed(speedStates[currentState]); OnSpeedChanged?.Invoke(); }
public void SetSpeed(float newSpeed) { var previousSpeed = _speed; _speed = newSpeed; OnSpeedChanged?.Invoke(this, new OnSpeedChangedEventArgs() { PreviousSpeed = previousSpeed, NewSpeed = newSpeed, SpeedManager = this, }); }
public void DecreaseSpeed(float decreaseBy) { var previousSpeed = _speed; _speed -= decreaseBy; OnSpeedChanged?.Invoke(this, new OnSpeedChangedEventArgs() { PreviousSpeed = previousSpeed, NewSpeed = _speed, SpeedManager = this, }); }
public void SetSpeedLevel(int num, bool isCashingState) { if (num >= speedStates.Count) { Debug.Log("No such speed"); return; } if (isCashingState) { cashedState = currentState; } currentState = num; level.SetSpeed(speedStates[currentState]); OnSpeedChanged?.Invoke(); }
public void IncreaseDifficulty() { OnSpeedChanged?.Invoke(speed); OnDifficultyChanged?.Invoke(difficulty); }
public void ResetDifficulty() { OnSpeedChanged?.Invoke(0); OnDifficultyChanged?.Invoke(0f); }
public void EventSpeedChanged(float speed) { OnSpeedChanged?.Invoke(speed); }