Пример #1
0
        public void TakeDamage(float damage)
        {
            float result = _curSkill - damage;

            if (result < 0)
            {
                FloatingText.Show("Not enough skill points", "PlayerTakeDamageText",
                                  new FromWorldPointTextPositioner(Camera.main, transform.position, 2f, 60f));
                return;
            }
            _curSkill = result;
            UpdateSkillBar();
        }
Пример #2
0
        public void TakeDamage(float damage)
        {
            if (Soldier.CheckIfMiss())
            {
                FloatingText.Show(string.Format("Miss"), "Miss",
                                  new FromWorldPointTextPositioner(Camera.main, transform.position, 2f, 60f));
                return;
            }
            float afterCalDamage = Mathf.Round(damage - (damage / Soldier.Armor));

            FloatingText.Show(string.Format("-{0}", afterCalDamage), "PlayerTakeDamageText",
                              new FromWorldPointTextPositioner(Camera.main, transform.position, 2f, 60f));
            float result = _curHealth - afterCalDamage;

            if (result < 0)
            {
                result = 0;
            }
            _curHealth = result;
            UpdateHealth();
        }