private void Start()
        {
            damageData = new DamageData
            {
                Attacker       = null,
                Attack         = null,
                DamagedTrigger = null,
                AttackingPart  = null,
                BlockedAttack  = null,

                IsDead = IsDead,
            };

            subComponentProcessor.damageData = damageData;
            subComponentProcessor.ComponentsDic.Add(SubComponentType.DAMAGE_DETECTOR, this);
        }
        private void Start()
        {
            damageData = new DamageData
            {
                BlockedAttack    = null,
                hp               = 1f,
                MarioStompAttack = MarioStompAttack,
                AxeThrow         = AxeThrow,

                damageTaken = new DamageTaken(null, null, null, null, Vector3.zero),

                IsDead     = IsDead,
                TakeDamage = ProcessDamage,
            };

            subComponentProcessor.damageData = damageData;
            subComponentProcessor.ArrSubComponents[(int)SubComponentType.DAMAGE_DETECTOR] = this;
        }
Example #3
0
        void AddForceToDamagedPart(RagdollPushType pushType)
        {
            if (control.DAMAGE_DATA.damageTaken == null)
            {
                return;
            }

            if (control.DAMAGE_DATA.damageTaken.ATTACKER == null)
            {
                return;
            }

            DamageData damageData = control.DAMAGE_DATA;

            Vector3 forwardDir = damageData.damageTaken.ATTACKER.transform.forward;
            Vector3 rightDir   = damageData.damageTaken.ATTACKER.transform.right;
            Vector3 upDir      = damageData.damageTaken.ATTACKER.transform.up;

            Rigidbody body   = control.DAMAGE_DATA.damageTaken.DAMAGEE.GetComponent <Rigidbody>();
            Attack    attack = damageData.damageTaken.ATTACK;

            if (pushType == RagdollPushType.NORMAL)
            {
                body.AddForce(
                    forwardDir * attack.normalRagdollVelocity.ForwardForce +
                    rightDir * attack.normalRagdollVelocity.RightForce +
                    upDir * attack.normalRagdollVelocity.UpForce);
            }
            else if (pushType == RagdollPushType.DEAD_BODY)
            {
                body.AddForce(
                    forwardDir * attack.collateralRagdollVelocity.ForwardForce +
                    rightDir * attack.collateralRagdollVelocity.RightForce +
                    upDir * attack.collateralRagdollVelocity.UpForce);
            }
        }