// Update is called once per frame void Update() { h = Input.GetAxis("Horizontal"); v = Input.GetAxis("Vertical"); moveVec = new Vector3(h, 0, v); if (h != 0 || v != 0) { animCtrl.PlayAnimation(AnimCurveEnum.Run); // 根据摄像机方向 进行移动 moveVec = Quaternion.Euler(0, mainCamTransform.eulerAngles.y, 0) * moveVec; charCtrl.Move(moveVec * speed * Time.deltaTime); RotatePlayer(); } else { animCtrl.PlayAnimation(AnimCurveEnum.Idle); } }
public void PlayAnimation(string animName) { animCtrl.PlayAnimation(animName); }