You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
705 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestMoveController : MonoBehaviour
{
public float speed = 100f;
void Update ()
{
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
transform.Translate(Vector3.right * Time.deltaTime * speed);
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
transform.Translate(Vector3.back * Time.deltaTime * speed);
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
transform.Translate(Vector3.left * Time.deltaTime * speed);
if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
transform.Translate(Vector3.forward * Time.deltaTime * speed);
}
}