32 lines
828 B
C#
32 lines
828 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace BITKit.Entities
|
|
{
|
|
public class EntityPhysics : EntityComponent, IHealthCallback
|
|
{
|
|
public Animator animator;
|
|
public Rigidbody[] rigidbodies;
|
|
public Collider[] ragdollColliders;
|
|
public override void OnStart()
|
|
{
|
|
entity.RegisterCallback<IHealthCallback>(this);
|
|
}
|
|
void IHealthCallback.OnSetAlive(bool alive)
|
|
{
|
|
if(animator)
|
|
animator.enabled = alive;
|
|
rigidbodies.ForEach(x =>
|
|
{
|
|
x.isKinematic = alive;
|
|
});
|
|
ragdollColliders.ForEach(x =>
|
|
{
|
|
x.enabled = !alive;
|
|
});
|
|
}
|
|
public void OnSetHP(int hp)
|
|
{
|
|
}
|
|
}
|
|
} |