Звук машин

This commit is contained in:
2025-01-25 16:18:02 +03:00
parent d9b9d51430
commit b194dc0191
18 changed files with 419 additions and 41 deletions

View File

@ -0,0 +1,33 @@
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine.XR.Interaction.Toolkit.Filtering;
public class ActivateUILineScript : MonoBehaviour
{
// Start is called before the first frame update
private XRInteractorLineVisual line;
private void Start()
{
line = GetComponent<XRInteractorLineVisual>();
if (line == null )
{
Debug.Log("XRInteractorLineVisual is empty");
}
}
public void OnPointerEnter()
{
line.enabled = true;
//Debug.Log("Point enter");
}
public void OnPointerExit()
{
line.enabled = false;
//Debug.Log("Point exit");
// Например, убрать подсветку
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3e106b11d8655d74ba0fb2855b2bdcf0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class AnimateHandOnInputScript : MonoBehaviour
{
public InputActionProperty PinchAnimationAction;
public InputActionProperty GripAnimationAction;
public Animator HandAnimator;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float tiggerValue = PinchAnimationAction.action.ReadValue<float>();
HandAnimator.SetFloat("Trigger", tiggerValue);
float gripValue = GripAnimationAction.action.ReadValue<float>();
HandAnimator.SetFloat("Grip", gripValue);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3fbbdb851e716ac4bbe51ce3ff1899a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class HitDetectorScript : MonoBehaviour
{
private bool _IsDead = false;
[SerializeField] private GameObject _Menu;
[SerializeField] private GameObject _ForwardSource;
private void OnTriggerEnter(Collider other)
{
//Debug.Log(other.gameObject.name);
if (other.gameObject.CompareTag("Car") && !_IsDead)
{
_IsDead = true;
Vector3 pos = _ForwardSource.transform.position;
Vector3 forward = _ForwardSource.transform.forward;
// Определите расстояние перед объектом
float distance = 1.0f;
// Вычислите новую позицию с учетом расстояния
Vector3 newPos = pos + forward.normalized * distance;
// Меню смотрит в том же направлении, что и источник, но фиксируется по вертикали
Quaternion newRot = Quaternion.LookRotation(new Vector3(forward.x, 0, forward.z));
// Создание объекта
Instantiate(_Menu, newPos, newRot);
Debug.Log("Player was hitted car");
//SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
}
}
//private void OnCollisionEnter(Collision collision)
//{
// Debug.Log(collision.gameObject.name);
//}
//private void OnControllerColliderHit(ControllerColliderHit hit)
//{
// Debug.Log(hit.gameObject.name);
// if (hit.gameObject.CompareTag("Car"))
// {
// Debug.Log("Car hitted");
// }
//}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a4c85452440a82d49ba8699717838f48
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MenuScript : MonoBehaviour
{
// Start is called before the first frame update
public void RestartGame()
{
SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
}
public void ExitGame()
{
Application.Quit();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 26b0535106e8eb44eb01489621492bb6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: