Bumper.cs 627 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Bumper : MonoBehaviour
  5. {
  6. public bool isBump1;
  7. public float speed = 5f;
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. if (isBump1)
  16. {
  17. transform.Translate(0f, Input.GetAxis("Vertical") * speed * Time.deltaTime, 0f);
  18. }
  19. else
  20. {
  21. //transform.Translate(0f, Input.GetAxis("Vertical2") * speed * Time.deltaTime, 0f);
  22. }
  23. }
  24. }