12345678910111213141516171819202122232425262728293031 |
- using Assets.StreetLight.Scripts;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Bumper : MonoBehaviour
- {
- public bool isBump1;
- public float speed = 5f;
- PersonManager PersonManager => personManagerLazy.Value;
- Lazy<PersonManager> personManagerLazy;
- private void Awake()
- {
- personManagerLazy = new Lazy<PersonManager>(FindObjectOfType<PersonManager>);
- }
- void Update()
- {
- if (isBump1)
- {
- transform.Translate(0f, Input.GetAxis("Vertical") * speed * Time.deltaTime, 0f);
- }
- else
- {
- //transform.Translate(0f, Input.GetAxis("Vertical2") * speed * Time.deltaTime, 0f);
- }
- }
- }
|