Exemple #1
0
 public void ClashedWithOtherMelee(MeleeDamagingCollider otherMelee)
 {
     _mouvementManager.AddKnockBack(otherMelee);
     otherMelee.Consumed();
     OnMeleeClashed();
     ClashFX(otherMelee);
 }
Exemple #2
0
    private void CheckForDamage(Collider2D collider, bool isBack)
    {
        var checkDamaging = collider.gameObject.GetComponent <IDamaging>();

        //If it is not damaging, dont bother with calculations
        if (checkDamaging != null && CheckIfIDamagableIsActive(checkDamaging))
        {
            Vector2 pointOfCollision = GetPointOfImpact(checkDamaging, collider, _centerOfReferenceForJuice, _raycastIterationsToFindTarget, _raycastVariationPerTry);
            float   damage;
            if (DamagingDoesDamage(checkDamaging, pointOfCollision, out damage))
            {
                float mulitpliedDmg = damage;
                if (isBack)
                {
                    mulitpliedDmg = Database.instance.BackDamageMultiplier * damage;
                }

                CurrentHp -= mulitpliedDmg;
                checkDamaging.Consumed();

                if (checkDamaging.AddImpactForce)
                {
                    checkDamaging.UpdateImpactForceSetting(GetDirectionFromImpact(collider,
                                                                                  checkDamaging.ImpactForceSettings));

                    _character.AddKnockBack(checkDamaging);
                }

                PlayRightSound(collider, isBack);

                var e = new ImpactEventArgs
                {
                    Damage           = damage,
                    type             = checkDamaging.TypeOfDamage,
                    PointOfCollision = pointOfCollision,
                    color            = _inputController.m_PlayerData.PlayerSponsor.SponsorColor
                };
                if (CurrentHp >= 0)
                {
                    OnHpImpactReceived(e);
                }
            }
        }
    }