Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
    public void NextSpeed()
    {
        currentState++;
        if (currentState >= speedStates.Count)
        {
            currentState = 0;
        }
        level.SetSpeed(speedStates[currentState]);

        OnSpeedChanged?.Invoke();
    }
Esempio n. 3
0
        public void SetSpeed(float newSpeed)
        {
            var previousSpeed = _speed;

            _speed = newSpeed;
            OnSpeedChanged?.Invoke(this, new OnSpeedChangedEventArgs()
            {
                PreviousSpeed = previousSpeed,
                NewSpeed      = newSpeed,
                SpeedManager  = this,
            });
        }
Esempio n. 4
0
        public void DecreaseSpeed(float decreaseBy)
        {
            var previousSpeed = _speed;

            _speed -= decreaseBy;
            OnSpeedChanged?.Invoke(this, new OnSpeedChangedEventArgs()
            {
                PreviousSpeed = previousSpeed,
                NewSpeed      = _speed,
                SpeedManager  = this,
            });
        }
Esempio n. 5
0
    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();
    }
Esempio n. 6
0
 public void IncreaseDifficulty()
 {
     OnSpeedChanged?.Invoke(speed);
     OnDifficultyChanged?.Invoke(difficulty);
 }
Esempio n. 7
0
 public void ResetDifficulty()
 {
     OnSpeedChanged?.Invoke(0);
     OnDifficultyChanged?.Invoke(0f);
 }
Esempio n. 8
0
 public void EventSpeedChanged(float speed)
 {
     OnSpeedChanged?.Invoke(speed);
 }