Skip to content

Instantly share code, notes, and snippets.

@yasuyuki-kamata
Created November 20, 2013 06:04
Show Gist options
  • Save yasuyuki-kamata/7558486 to your computer and use it in GitHub Desktop.
Save yasuyuki-kamata/7558486 to your computer and use it in GitHub Desktop.
方向キーでAnimator Componentのパラメータを変更する
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Animator))]
public class PlayerControl : MonoBehaviour {
private Animator animator;
// Use this for initialization
void Start () {
animator = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
animator.SetBool ("DownArrow", Input.GetKey(KeyCode.DownArrow));
animator.SetBool ("RightArrow", Input.GetKey(KeyCode.RightArrow));
animator.SetBool ("LeftArrow", Input.GetKey(KeyCode.LeftArrow));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment