Звук машин
This commit is contained in:
33
Assets/Crossy Road VR/Scripts/ActivateUILineScript.cs
Normal file
33
Assets/Crossy Road VR/Scripts/ActivateUILineScript.cs
Normal 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");
|
||||
// Например, убрать подсветку
|
||||
}
|
||||
}
|
11
Assets/Crossy Road VR/Scripts/ActivateUILineScript.cs.meta
Normal file
11
Assets/Crossy Road VR/Scripts/ActivateUILineScript.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e106b11d8655d74ba0fb2855b2bdcf0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Assets/Crossy Road VR/Scripts/AnimateHandOnInputScript.cs
Normal file
28
Assets/Crossy Road VR/Scripts/AnimateHandOnInputScript.cs
Normal 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);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fbbdb851e716ac4bbe51ce3ff1899a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
53
Assets/Crossy Road VR/Scripts/HitDetectorScript.cs
Normal file
53
Assets/Crossy Road VR/Scripts/HitDetectorScript.cs
Normal 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");
|
||||
// }
|
||||
//}
|
||||
}
|
11
Assets/Crossy Road VR/Scripts/HitDetectorScript.cs.meta
Normal file
11
Assets/Crossy Road VR/Scripts/HitDetectorScript.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4c85452440a82d49ba8699717838f48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
18
Assets/Crossy Road VR/Scripts/MenuScript.cs
Normal file
18
Assets/Crossy Road VR/Scripts/MenuScript.cs
Normal 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();
|
||||
}
|
||||
}
|
11
Assets/Crossy Road VR/Scripts/MenuScript.cs.meta
Normal file
11
Assets/Crossy Road VR/Scripts/MenuScript.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26b0535106e8eb44eb01489621492bb6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user