-
-
Save tsubaki/9def5859d346c39afbc0 to your computer and use it in GitHub Desktop.
視界判定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class SightCheck : StateMachineBehaviour | |
{ | |
Animator target; | |
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) | |
{ | |
if( target == null ){ | |
target = GameObject.Find("Canvas/Enemy").GetComponent<Animator>(); | |
} | |
} | |
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) | |
{ | |
if( target.GetCurrentAnimatorStateInfo(0).IsName("Look") ){ | |
animator.SetTrigger("DeadTrigger"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment