U3D 脚本控制Animator

using UnityEngine;
using System.Collections;

public class Ctrl : MonoBehaviour {

Animator an;
// Use this for initialization
void Start () {

an = GetComponent<Animator>();
}

// Update is called once per frame
void Update () {

if (Input.GetKeyDown(KeyCode.Space))
{
an.SetBool("Jump",true);  
}
if (Input.GetKeyUp(KeyCode.Space))
{
an.SetBool("Jump", false);
}
if (Input.GetKeyDown(KeyCode.H))
{
an.SetTrigger("Hand");
}
if (Input.GetKeyDown(KeyCode.Alpha5))
{
an.SetInteger("Lose",5);
}
if (Input.GetKeyDown(KeyCode.Alpha0))
{
an.SetFloat("Walk",0);
}
}
}

posted @ 2017-11-07 13:58  0null0  阅读(816)  评论(0编辑  收藏  举报