需求:在游戏界面中,实现物体从屏幕左边出去,从右边进来的功能。也可对横向、纵向的运动进行限制。以及物体是如何在游戏中实现键盘控制移动的。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float moveSpeed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()