Добавлен максимальный счёт с сохранением
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
using static UnityEngine.XR.OpenXR.Features.Interactions.DPadInteraction;
|
||||
|
||||
public class HitDetectorScript : MonoBehaviour
|
||||
{
|
||||
@ -23,13 +22,20 @@ public class HitDetectorScript : MonoBehaviour
|
||||
[SerializeField] XRBaseController _LeftController;
|
||||
[SerializeField] XRBaseController _RightController;
|
||||
|
||||
[HideInInspector]
|
||||
public UnityEvent Dead = new UnityEvent();
|
||||
|
||||
[SerializeField] private ScoreManagerScript _ScoreManager;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
//Debug.Log(other.gameObject.name);
|
||||
if (other.gameObject.CompareTag("Car") && !_IsDead)
|
||||
{
|
||||
if (PlayerPrefs.GetInt("Best score") < _ScoreManager.CurrentScore)
|
||||
{
|
||||
PlayerPrefs.SetInt("Best score", _ScoreManager.CurrentScore);
|
||||
}
|
||||
_IsDead = true;
|
||||
|
||||
Dead.Invoke();
|
||||
@ -40,7 +46,7 @@ public class HitDetectorScript : MonoBehaviour
|
||||
UISpawn();
|
||||
|
||||
TriggerHaptic(_LeftController);
|
||||
TriggerHaptic (_RightController);
|
||||
TriggerHaptic(_RightController);
|
||||
|
||||
Debug.Log("Player was hitted car");
|
||||
//SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
|
||||
|
Reference in New Issue
Block a user