Скрипт касания игрока машиной, переделывание префабов
This commit is contained in:
@ -13,9 +13,29 @@ public class CarControllerScript : MonoBehaviour
|
||||
[SerializeField]
|
||||
private List<GameObject> _Wheels = new List<GameObject>();
|
||||
|
||||
/// <summary>
|
||||
/// to do
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private int _Speed;
|
||||
|
||||
/// <summary>
|
||||
/// высота,чтобы колёса стояли на 0
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private float _High;
|
||||
|
||||
public float High
|
||||
{
|
||||
get => _High;
|
||||
set => _High = value;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_High = gameObject.transform.position.y;
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
foreach (var wheel in _Wheels)
|
||||
@ -23,4 +43,6 @@ public class CarControllerScript : MonoBehaviour
|
||||
wheel.transform.Rotate(Vector3.right * _Speed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user