-
-
Save tsubaki/9a1e1c025d30202e12d6 to your computer and use it in GitHub Desktop.
StateMachineBehaviourの挙動
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; | |
public class BooleanSwitchByKey : StateMachineBehaviour | |
{ | |
[SerializeField] | |
KeyCode keycode; | |
[SerializeField] | |
string parameterName; | |
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) | |
{ | |
animator.SetBool(parameterName, Input.GetKey(keycode)); | |
} | |
} |
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 Walk : StateMachineBehaviour { | |
[SerializeField, Range(0, 3)] | |
float speed = 0; | |
override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) | |
{ | |
Transform transform = animator.transform; | |
transform.position += transform.right * speed * Time.deltaTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment