add change trains
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user