private void TakeDamage(AttackInfo info) { if (DamageTaken > 0) { 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.animationProgress.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++; DamageTaken++; AttackManager.Instance.ForceDeregister(control); control.animationProgress.RagdollTriggered = true; control.GetComponent <BoxCollider>().enabled = false; control.ledgeChecker.GetComponent <BoxCollider>().enabled = false; control.RIGID_BODY.useGravity = false; if (control.aiController != null) { control.aiController.gameObject.SetActive(false); control.navMeshObstacle.enabled = false; } }
private void ToggleBoxCol(CharacterControl control) { control.RIGID_BODY.velocity = Vector3.zero; control.GetComponent <BoxCollider>().enabled = On; if (RepositionSpheres) { control.COLLISION_SPHERE_DATA.Reposition_FrontSpheres(); control.COLLISION_SPHERE_DATA.Reposition_BottomSpheres(); control.COLLISION_SPHERE_DATA.Reposition_BackSpheres(); control.COLLISION_SPHERE_DATA.Reposition_UpSpheres(); } }
private void TakeDamage(AttackInfo info) { if (IsDead()) { if (!info.RegisteredTargets.Contains(this.control)) { info.RegisteredTargets.Add(this.control); control.AddForceToDamagedPart(); } 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.animationProgress.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); if (IsDead()) { control.animationProgress.RagdollTriggered = true; control.GetComponent <BoxCollider>().enabled = false; control.ledgeChecker.GetComponent <BoxCollider>().enabled = false; 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); } }