using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour
{
public float moveSpeed = 3;
public Animator animator;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
move();
}
private void move()//移动方法
{
float h = Input.GetAxisRaw("Horizontal");
transform.Translate(Vector3.right * h * moveSpeed * Time.deltaTime, Space.World);
animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
}
}