Global Game Jam 2023
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.

35 lines
804 B

1 year ago
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class CubeTestController : MonoBehaviour
  5. {
  6. [SerializeField]
  7. private float forwardSpeed = 1;
  8. [SerializeField]
  9. private float turningSpeed = 90;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. }
  14. // Update is called once per frame
  15. void Update()
  16. {
  17. Vector3 _pos = transform.position;
  18. _pos += transform.forward * forwardSpeed * Time.deltaTime;
  19. if (Input.GetKey(KeyCode.A))
  20. transform.Rotate(new Vector3(0, -turningSpeed * Time.deltaTime, 0));
  21. if (Input.GetKey(KeyCode.D))
  22. transform.Rotate(new Vector3(0, turningSpeed * Time.deltaTime, 0));
  23. transform.position = _pos;
  24. }
  25. }