Skip to main content

动画

'Speed' 和 'Angular' 是动画里面 中 Parameters 设置的

using UnityEngine;
using System.Collections;

public class DefaultAvatar : MonoBehaviour {

private Animator anim;

void Awake() {
anim = this.GetComponent<Animator>();
//anim.SetFloat("Speed", 0.2f);
}

// Update is called once per frame
void Update () {
float vertical = Input.GetAxis("Vertical");
anim.SetFloat("Speed", vertical);
anim.SetFloat("Angular", Input.GetAxis("Horizontal"));

if (Input.GetKeyDown(KeyCode.Space)) {
anim.SetBool("Dead", true);
}
}
}