late goodbye
This commit is contained in:
@@ -4,9 +4,11 @@ using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
public class InputHandler : MonoBehaviour, IGameComponent
|
||||
public class InputHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float speed = 2;
|
||||
private Transform cameraTransform;
|
||||
private Quaternion lastRotation;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -15,14 +17,14 @@ public class InputHandler : MonoBehaviour, IGameComponent
|
||||
|
||||
void Start()
|
||||
{
|
||||
GameSystem.Instance.AddGameComponent(this);
|
||||
// GameSystem.Instance.AddGameComponent(this);
|
||||
Input.gyro.enabled = true;
|
||||
}
|
||||
|
||||
public void OnUpdate()
|
||||
public void Update()
|
||||
{
|
||||
var phoneRotation = Input.gyro.attitude;
|
||||
cameraTransform.rotation = phoneRotation;
|
||||
cameraTransform.rotation = lastRotation;
|
||||
lastRotation = Quaternion.Lerp(transform.rotation, Input.gyro.attitude, speed * Time.deltaTime);
|
||||
|
||||
cameraTransform.Rotate(0, 0, 180, Space.Self);
|
||||
cameraTransform.Rotate(90, 180, 0, Space.World);
|
||||
@@ -33,6 +35,6 @@ public class InputHandler : MonoBehaviour, IGameComponent
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
GameSystem.Instance.RemoveGameComponent(this);
|
||||
// GameSystem.Instance.RemoveGameComponent(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user