Created
November 20, 2013 06:04
-
-
Save yasuyuki-kamata/7558486 to your computer and use it in GitHub Desktop.
方向キーでAnimator Componentのパラメータを変更する
This file contains hidden or 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; | |
[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