Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created December 28, 2024 08:24
Show Gist options
  • Save todorok1/f9ee50bcb436f63e4797fe7ff352a9d3 to your computer and use it in GitHub Desktop.
Save todorok1/f9ee50bcb436f63e4797fe7ff352a9d3 to your computer and use it in GitHub Desktop.
シンプルRPGのチュートリアル アニメーションの遷移の確認
using UnityEngine;
public class AnimTest : MonoBehaviour
{
Animator animator;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
animator = gameObject.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.DownArrow))
{
animator.SetInteger("Direction", 0);
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
animator.SetInteger("Direction", 1);
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
animator.SetInteger("Direction", 2);
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
animator.SetInteger("Direction", 3);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment