Create Health and Ragdoll component and and them to enemy

This commit is contained in:
2024-08-09 17:36:09 +02:00
parent 01c6f898f3
commit f3623c6036
6 changed files with 146 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RagdollComponent : MonoBehaviour
{
[Button]
public void Ragdoll()
{
var rigidBodies = GetComponentsInChildren<Rigidbody>();
foreach (var rb in rigidBodies)
{
rb.isKinematic = false;
}
var animators = GetComponentsInChildren<Animator>();
foreach (var a in animators)
{
a.enabled = false;
}
}
}