Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active February 20, 2016 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/716dc44f76caa0a884e6 to your computer and use it in GitHub Desktop.
Save tsubaki/716dc44f76caa0a884e6 to your computer and use it in GitHub Desktop.
再生中のアニメーションが判別できない
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