Skip to content

Instantly share code, notes, and snippets.

@tsubaki tsubaki/EnemyMovement.cs
Last active Feb 20, 2016

Embed
What would you like to do?
再生中のアニメーションが判別できない
using UnityEngine;
using System.Collections;
public class EnemyMovement : MonoBehaviour {
public Transform player;
private NavMeshAgent nav;
private Animator animator;
// Use this for initialization
void Start () {
nav = GetComponent <NavMeshAgent> ();
animator = GetComponent <Animator> ();
}
// Update is called once per frame
void Update () {
//目的地の更新(Playerの現在の位置)
//nav.SetDestination (player.position);
//アニメーション中の挙動
Behave_In_Animation();
}
void Behave_In_Animation(){
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
Debug.Log (stateInfo.fullPathHash);
if(stateInfo.IsName("Attack1")){
Debug.Log ("aaa");
}
if(stateInfo.IsName("Attack2")){
Debug.Log ("bbb");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.