Create Health and Ragdoll component and and them to enemy
This commit is contained in:
25
Assets/Scripts/Components/RagdollComponent.cs
Normal file
25
Assets/Scripts/Components/RagdollComponent.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user