24 lines
599 B
C#
24 lines
599 B
C#
using UnityEngine;
|
|
|
|
using RR.Game2D.Behaviour;
|
|
|
|
public class EnemyAnimationEvents : MonoBehaviour
|
|
{
|
|
public void OnDeathEnd()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
public void OnDeathBegin()
|
|
{
|
|
Rigidbody2D rb = GetComponent<Rigidbody2D>();
|
|
Collider2D col = GetComponent<Collider2D>();
|
|
EnemyController controller = GetComponent<EnemyController>();
|
|
if (controller) controller.enabled = false;
|
|
if (col) col.enabled = false;
|
|
if (!rb) return;
|
|
rb.linearVelocity = Vector2.zero;
|
|
rb.bodyType = RigidbodyType2D.Kinematic;
|
|
}
|
|
}
|