Exemplo n.º 1
0
        // -----------------------------------------------------------------------------------
        // Hit
        // -----------------------------------------------------------------------------------
        public void Hit(HitInfo hitInfo)
        {
            if (health <= 0)
            {
                return;
            }

            Character source = null;

            if (hitInfo.source is Player)
            {
                source = Obj.GetPlayer;
            }

            DamageResult damageResult = Utl.DamageFormula(hitInfo.damage, defence, source);

            health -= damageResult.amount;
            SoundController.Play(hitSound, transform.position);

            if (hitInfo.isShowEffect && damageResult.amount > 0)
            {
                if (hitEffectObject != null)
                {
                    GameObject hitEffect = Instantiate(hitEffectObject, hitInfo.point, Quaternion.identity) as GameObject;
                    Destroy(hitEffect, 3);
                }
            }

            if (health <= 0)
            {
                Death();
            }
        }
Exemplo n.º 2
0
        // -----------------------------------------------------------------------------------
        // Hit
        // -----------------------------------------------------------------------------------
        public override void Hit(HitInfo hitInfo)
        {
            if (statistics.Health <= 0)
            {
                return;
            }

            DamageResult damageResult = Utl.DamageFormula(hitInfo.damage, resistances.resistances, hitInfo.source, this, hitInfo.baseAmount);

            hitInfo.amount = damageResult.amount;

            base.Hit(hitInfo);

            inventory.DamageEquipment((int)Mathf.Round(hitInfo.amount * hitInfo.damage.equipmentDamage));
        }
Exemplo n.º 3
0
        // -----------------------------------------------------------------------------------
        // Hit
        // -----------------------------------------------------------------------------------
        public override void Hit(HitInfo hitInfo)
        {
            DamageResult damageResult = Utl.DamageFormula(hitInfo.damage, resistances.resistances, hitInfo.source, this, hitInfo.baseAmount);

            hitInfo.amount = damageResult.amount;

            base.Hit(hitInfo);

            StartShake();

            if (hitInfo.source is Player)
            {
                Obj.GetPlayer.AdjustProperty(rewardStatisticBoost);
            }

            if (hitInfo.isShowEffect && hitEffectObject != null)
            {
                GameObject hitEffect = Instantiate(hitEffectObject, hitInfo.point, Quaternion.identity) as GameObject;
                Destroy(hitEffect, 3);
            }
        }