add change trains

This commit is contained in:
2022-11-12 06:11:51 +05:00
parent ea7a810971
commit b9e9cb72fe
132 changed files with 9427 additions and 6197 deletions
+2 -20
View File
@@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class InputHandler : MonoBehaviour, IGameComponent
{
@@ -15,7 +14,6 @@ public class InputHandler : MonoBehaviour, IGameComponent
w
}
private Controls inputSystem;
private Transform cameraTransform;
private float X0;
@@ -42,34 +40,18 @@ public class InputHandler : MonoBehaviour, IGameComponent
void Awake()
{
inputSystem = new Controls();
cameraTransform = transform;
}
void Start()
{
GameSystem.Instance.AddGameComponent(this);
}
void OnEnable()
{
inputSystem.Enable();
InputSystem.EnableDevice(UnityEngine.InputSystem.AttitudeSensor.current);
}
void OnDisable()
{
InputSystem.DisableDevice(UnityEngine.InputSystem.AttitudeSensor.current);
inputSystem.Disable();
Input.gyro.enabled = true;
}
public void OnUpdate()
{
var phoneRotation = inputSystem
.Rotation
.Gyroscope
.ReadValue<Quaternion>();
var phoneRotation = Input.gyro.attitude;
cameraTransform.rotation = phoneRotation;
cameraTransform.Rotate(0, 0, 180, Space.Self);