public void TakeDamage()
        {
            var damageRange  = m_Random.Next(Damage.GetBaseValue());
            var defenceRange = m_Random.Next(Defence.GetBaseValue());
            var range        = (damageRange - defenceRange);

            if (range < 0)
            {
                range = 0;
            }

            Debug.Log($"Character took {range} amount of damage.");
            splatMarker.Show(range);
            m_HealthObject.Damage(range);

            if (m_HealthObject.CurrentHealth <= 0)
            {
                m_PlayerExperience.IncreaseExperience(CombatLevel * 10);
                Debug.Log("Character dead.");
            }
        }
Beispiel #2
0
        public void TakeDamage(int damage)
        {
            var randomDamage  = m_Random.Next(damage);
            var blockedDamage = m_Random.Next(Defence.GetBaseValue());
            var finalDamage   = randomDamage - blockedDamage;

            if (finalDamage < 0)
            {
                finalDamage = 0;
            }

            Debug.Log($"Damage: {randomDamage}, Blocked Damage: {blockedDamage}, Final Damage: {finalDamage}");

            m_HealthObject.Damage(finalDamage);
            m_SplatMarker.Show(finalDamage);

            if (m_HealthObject.CurrentHealth <= 0)
            {
                Debug.Log("Player Died.");
                SceneManager.LoadScene("Game");
            }
        }