Exemplo n.º 1
0
 public void RegisterStat(CharacterStat stat)
 {
     if (Stats.ContainsKey(stat.Type))
     {
         return;
     }
     Stats.Add(stat.Type, stat);
 }
Exemplo n.º 2
0
        public void OnHealthChanged(CharacterStat stat)
        {
            if (_prevHealthValue > stat.CurrentValue)
            {
                _damageTakenItem?.Stop();
                _damageTakenItem = DamageEffect.GetExplosionItem(0.3f).PlayRegisterAndReturnSelf();
            }

            _prevHealthValue = stat.CurrentValue;
        }
Exemplo n.º 3
0
        private void ResetStats()
        {
            Stats.Clear();
            var maxHealth = _model.Health.GetValue(Level - 1);
            var health    = new CharacterStat(CharacterStatType.Health, maxHealth);

            this.RegisterStat(health);

            var maxSpeed = _model.MaxSpeed.GetValue(Level - 1);
            var speed    = new CharacterStat(CharacterStatType.MaxSpeed, maxSpeed);

            this.RegisterStat(speed);

            var maxEnergy = _model.Energy.GetValue(Level - 1);
            var energy    = new CharacterStat(CharacterStatType.Energy, maxEnergy);

            this.RegisterStat(energy);

            var maxPassiveDamage = _model.PassiveDamage.GetValue(Level - 1);
            var passiveDamage    = new CharacterStat(CharacterStatType.PassiveDamage, maxPassiveDamage);

            this.RegisterStat(passiveDamage);
        }
Exemplo n.º 4
0
 private void Awake()
 {
     _rigidbody = GetComponentInChildren <Rigidbody2D>();
     HitsCount  = new CharacterStat(CharacterStatType.Energy, 9999);
 }