Unity脚本编译报错求助
  • 板块灌水区
  • 楼主JoeBiden2020
  • 当前回复4
  • 已保存回复4
  • 发布时间2021/10/30 23:21
  • 上次更新2023/11/4 01:48:07
查看原帖
Unity脚本编译报错求助
432183
JoeBiden2020楼主2021/10/30 23:21
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMove : MonoBehaviour
{
    public float moveSpeed = 2f;
    public float rotateSpeed = 0.01f;
    // Start is called before the first frame update
    void Start()
    {
        
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode).UpArrow)
        {
            this.transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

        }
        if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode).DownArrow)
        {
            this.transform.Translate(Vector3.back * moveSpeed * Time.deltaTime);

        }
        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode).LeftArrow)
        {
            this.transform.Rotate(Vector3.down * rotateSpeeed);
        }
        if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode).RightArrow)
        {
            this.transform.Rotate(Vector3.up * rotateSpeeed);
        }
    }
}

2021/10/30 23:21
加载中...