31 lines
620 B
C#
31 lines
620 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class EnemyAnimationHandler : MonoBehaviour
|
|
{
|
|
Animator animator;
|
|
void Start()
|
|
{
|
|
animator = GetComponentInChildren<Animator>();
|
|
if (animator == animator.enabled)
|
|
animator.enabled = false;
|
|
|
|
}
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.F))
|
|
Strangle();
|
|
if (Input.GetKeyDown(KeyCode.G))
|
|
Die();
|
|
}
|
|
public void Strangle()
|
|
{
|
|
animator.enabled = true;
|
|
}
|
|
public void Die()
|
|
{
|
|
animator.SetTrigger("Die");
|
|
}
|
|
}
|