Exemple #1
0
 private float CalculateDamage()
 {
     if (UnityEngine.Random.Range(0.0f, 1.0f) <= criticalHitChance)
     {
         print("Critical Hit");
         criticalParticleSystem.Play();
         return(baseDamage + currentWeaponConfig.GetAdditionalDamage() * criticalHitMultiplier);
     }
     else
     {
         print("Normal Hit");
         return(baseDamage + currentWeaponConfig.GetAdditionalDamage());
     }
 }
Exemple #2
0
        float CalculateDamage()
        {
            float totalDamage = baseDamage + getCurrentWeapon.GetAdditionalDamage();

            if (UnityEngine.Random.Range(0f, 1.0f) <= criticalHitChance)
            {
                criticalHitParticle.Play();
                totalDamage *= criticalHitMultiplier;
            }
            return(totalDamage);
        }
Exemple #3
0
        private float CalculateDamage()
        {
            // allow critical hit
            bool  isCriticalHit        = UnityEngine.Random.Range(0f, 1f) <= criticalHitChance;
            float damageBeforeCritical = baseDamage + currentWeaponConfig.GetAdditionalDamage();

            if (isCriticalHit)
            {
                criticalHitParticle.Play();
                return(damageBeforeCritical * criticalHitMultiplier);
            }
            else
            {
                return(damageBeforeCritical);
            }
        }
Exemple #4
0
        private float CalculateDamage()
        {
            // allow critical hit
            bool  isCriticalHit        = UnityEngine.Random.Range(0f, 1f) <= criticalHitChance;
            float damageBeforeCritical = baseDamage + currentWeaponConfig.GetAdditionalDamage();

            if (isCriticalHit)
            {
                if (criticalHitParticle)
                {
                    criticalHitParticle.Play();
                    Debug.LogWarning("Critical Hit Prefab is not Assigned For : " + gameObject.name + "..  Please Assign 1.");
                }
                return(damageBeforeCritical * criticalHitMultiplier);
            }
            else
            {
                return(damageBeforeCritical);
            }
        }
Exemple #5
0
        float CalculateDamage()
        {
            return(baseDamage + currentWeaponConfig.GetAdditionalDamage());
            // if a random number between 0 and 1 is less than or equanl to the criticalHitChance then
            // we have a critical hit
            // if criticalHitChance is 1 it's 100% chance that your number will be in the range
            // if criticalHitChance is 0.1 it's a 10% chance that a number picked randomly between 0 and 1
            // will be less or equal to 0.1
            // 0.2 <= 1 =  true
            // 0.2 <= 0.1 = false
            // 0.1 <= 0.1 = true
            //bool isCriticalHit = UnityEngine.Random.Range(0f, 1f) <= criticalHitChance;
            //float damageBeforeCritical = baseDamage + currentWeaponConfig.GetAdditionalDamage();

            // if it is critical damage, multiple the damage by the criticalHitMultiplier
            //if (isCriticalHit)
            //{
            //    criticalHitParticle.Play();
            //    return damageBeforeCritical * criticalHitMultiplier;
            //}

            //return damageBeforeCritical;
        }
Exemple #6
0
 float CalculateDamage()
 {
     return(baseDamage + currentWeaponConfig.GetAdditionalDamage());
 }
Exemple #7
0
        private float CalculateDamage()
        {
            float damage = baseDamage + currentWeaponConfig.GetAdditionalDamage();

            return(damage);
        }