public void TakeDamage(AttackInfo info) { if (IsDead()) { if (!info.RegisteredTargets.Contains(this.control)) { info.RegisteredTargets.Add(this.control); control.AddForceToDamagedPart(true); } return; } if (IsBlocked(info)) { BlockedAttack = info; return; } if (info.MustCollide) { CameraManager.Instance.ShakeCamera(0.3f); if (info.AttackAbility.UseDeathParticles) { if (info.AttackAbility.ParticleType.ToString().Contains("VFX")) { GameObject vfx = PoolManager.Instance.GetObject(info.AttackAbility.ParticleType); vfx.transform.position = control.damageDetector.AttackingPart.transform.position; vfx.SetActive(true); if (info.Attacker.IsFacingForward()) { vfx.transform.rotation = Quaternion.Euler(0f, 0f, 0f); } else { vfx.transform.rotation = Quaternion.Euler(0f, 180f, 0f); } } } } Debug.Log(info.Attacker.gameObject.name + " hits: " + this.gameObject.name); info.CurrentHits++; hp -= info.AttackAbility.Damage; AttackManager.Instance.ForceDeregister(control); control.animationProgress.CurrentRunningAbilities.Clear(); if (IsDead()) { control.animationProgress.RagdollTriggered = true; control.GetComponent <BoxCollider>().enabled = false; control.ProcDic[CharacterProc.LEDGE_COLLIDERS_OFF](); control.RIGID_BODY.useGravity = false; if (control.aiController != null) { control.aiController.gameObject.SetActive(false); control.navMeshObstacle.enabled = false; } } else { int rand = Random.Range(0, HitReactionList.Count); control.SkinnedMeshAnimator.runtimeAnimatorController = null; control.SkinnedMeshAnimator.runtimeAnimatorController = HitReactionList[rand]; } if (!info.RegisteredTargets.Contains(this.control)) { info.RegisteredTargets.Add(this.control); } }
public void TakeDamage(AttackInfo info) { if (IsDead()) { if (!info.RegisteredTargets.Contains(this.control)) { info.RegisteredTargets.Add(this.control); control.AddForceToDamagedPart(true); } return; } if (IsBlocked(info)) { damageData.BlockedAttack = info; return; } if (info.MustCollide) { CameraManager.Instance.ShakeCamera(0.3f); if (info.AttackAbility.UseDeathParticles) { if (info.AttackAbility.ParticleType.ToString().Contains("VFX")) { GameObject vfx = PoolManager.Instance.GetObject(info.AttackAbility.ParticleType); vfx.transform.position = damageData.AttackingPart.transform.position; vfx.SetActive(true); if (info.Attacker.ROTATION_DATA.IsFacingForward()) { vfx.transform.rotation = Quaternion.Euler(0f, 0f, 0f); } else { vfx.transform.rotation = Quaternion.Euler(0f, 180f, 0f); } } } } Debug.Log(info.Attacker.gameObject.name + " hits: " + this.gameObject.name); info.CurrentHits++; hp -= info.AttackAbility.Damage; AttackManager.Instance.ForceDeregister(control); control.animationProgress.CurrentRunningAbilities.Clear(); if (IsDead()) { control.RAGDOLL_DATA.RagdollTriggered = true; } else { int rand = Random.Range(0, HitReactionList.Count); control.SkinnedMeshAnimator.runtimeAnimatorController = null; control.SkinnedMeshAnimator.runtimeAnimatorController = HitReactionList[rand]; } if (!info.RegisteredTargets.Contains(this.control)) { info.RegisteredTargets.Add(this.control); } }