using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour {
public int speed = 5;
Animator ani;
// Use this for initialization
void Start()
{
ani = this.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
float h = Input.GetAxis("Horizontal");//水平 ad
float v = Input.GetAxis("Vertical");//垂直输入量 ws
Vector3 moveVec = new Vector3(h, 0, v);
transform.Translate(moveVec * speed * Time.deltaTime);
if(Input.GetKeyDown(KeyCode.J))
{
ani.SetInteger("fight", 2);
}
if(Input.GetKeyUp(KeyCode.J))
{
ani.SetInteger("fight", 0);
}
}
}
移动2
最新推荐文章于 2022-12-27 11:48:08 发布