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

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TestMoveController : MonoBehaviour
  5. {
  6. public float speed = 100f;
  7. void Update ()
  8. {
  9. if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
  10. transform.Translate(Vector3.right * Time.deltaTime * speed);
  11. if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
  12. transform.Translate(Vector3.back * Time.deltaTime * speed);
  13. if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
  14. transform.Translate(Vector3.left * Time.deltaTime * speed);
  15. if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
  16. transform.Translate(Vector3.forward * Time.deltaTime * speed);
  17. }
  18. }