动画组合 一边跑一边攻击
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class One : MonoBehaviour
{
private Animator anim;
// Start is called before the first frame update
void Start()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Alpha0))
{
anim.SetInteger("i", 0);
}
else if (Input.GetKeyDown(KeyCode.Alpha1))
{
anim.SetInteger("i", 1);
}
else if (Input.GetKeyDown(KeyCode.Alpha2))
{
anim.SetInteger("i", 2);
}
else if (Input.GetKeyDown(KeyCode.Alpha3))
{
anim.SetInteger("i", 3);
}
else if (Input.GetKeyDown(KeyCode.Alpha4))
{
anim.SetInteger("i", 4);
}
}
}