Exemplo n.º 1
0
        private void TakeDamage(AttackInfo info)
        {
            if (info.MustCollide)
            {
                CameraManager.Instance.ShakeCamera(0.2f);
            }

            Debug.Log(info.Attacker.gameObject.name + " hits: " + this.gameObject.name);
            Debug.Log(this.gameObject.name + " hit in " + DamagedPart.ToString());

            //control.SkinnedMeshAnimator.runtimeAnimatorController = info.AttackAbility.GetDeathAnimator();
            control.SkinnedMeshAnimator.runtimeAnimatorController = DeathAnimationManager.Instance.GetAnimator(DamagedPart, info);
            info.CurrentHits++;

            control.GetComponent <BoxCollider>().enabled = false;
            control.RIGID_BODY.useGravity = false;
        }
Exemplo n.º 2
0
        private void TakeDamage(AttackInfo info)
        {
            control.CacheCharacterControl(control.SkinnedMeshAnimator);
            control.RIGID_BODY.velocity = Vector3.zero;
            float dam = info.AttackAbility.damage;
            float w   = control.weight;
            float s   = info.AttackAbility.scaler;
            float b   = info.AttackAbility.baseMultiplier;

            if (control.FaceLeft)
            {
                control.RIGID_BODY.AddForce(Vector3.forward * (((((7 * (dam + 2) * (hp)) / (w + 100)) + 9) * (2 * s)) + b));
            }
            if (control.FaceRight)
            {
                control.RIGID_BODY.AddForce(-Vector3.forward * (((((7 * (dam + 2) * (hp)) / (w + 100)) + 9) * (2 * s)) + b));
            }

            if (info.CurrentHits != info.MaxHits)
            {
                if (info.MustCollide)
                {
                    hp += info.AttackAbility.damage;
                    info.CurrentHits++;
                }
            }

            if (IsDead())
            {
                Respawn();
            }

            else
            {
                control.SkinnedMeshAnimator.runtimeAnimatorController = null;
                control.SkinnedMeshAnimator.runtimeAnimatorController = HitReactionList[0];
            }



            Debug.Log(info.Attacker.gameObject.name + " hits: " + this.gameObject.name);
            Debug.Log(this.gameObject.name + " hit in " + DamagedPart.ToString());

            //control.SkinnedMeshAnimator.runtimeAnimatorController = info.AttackAbility.GetDeathAnimator();
        }