using System.Collections; using System.Collections.Generic; using UnityEngine; public class No10_Animator : MonoBehaviour { public Animator animator; void Start() { animator.Play("Run"); animator.speed = 5; animator.speed = 0.5f; animator.SetFloat("Speed", 1); animator.SetBool("Dead",false); animator.SetInteger("HP", 100); print("当前速度参数是:" + animator.GetFloat("Speed")); } // Update is called once per frame void Update() { //按键切换动画状态 if (Input.GetKeyDown(KeyCode.W)) { animator.CrossFade("Walk", 1f); } } }