You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RatAttack2D/Assets/Scripts/Enemy_stat2.cs

28 lines
686 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy_stat2 : StateMachineBehaviour
{
private bool no;
private float wait;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
wait = 0;
no = false;
}
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if(no)
{
return;
}
if(wait >= 1f)
{
Enemy_Frog Fr = animator.GetComponent<Enemy_Frog>();
Fr.shoot();
no = true;
}
wait += Time.deltaTime;
}
}