-
-
Save tsubaki/64f93d8f22b87b333b47 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 Turn : StateMachineBehaviour { | |
float endTime; | |
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { | |
endTime = Time.timeSinceLevelLoad + Random.Range(1.0f, 5.0f); | |
} | |
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { | |
if( Time.timeSinceLevelLoad > endTime ){ | |
animator.SetTrigger("Turn"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment