40 lines
930 B
C#
40 lines
930 B
C#
using System.Linq;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
public class InputHandler : MonoBehaviour
|
|
{
|
|
[SerializeField] private float speed = 2;
|
|
private Transform cameraTransform;
|
|
private Quaternion lastRotation;
|
|
|
|
void Awake()
|
|
{
|
|
cameraTransform = transform;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
// GameSystem.Instance.AddGameComponent(this);
|
|
Input.gyro.enabled = true;
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
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);
|
|
}
|
|
|
|
public void OnFixedUpdate() { }
|
|
public void OnLateUpdate() { }
|
|
|
|
public void OnDestroy()
|
|
{
|
|
// GameSystem.Instance.RemoveGameComponent(this);
|
|
}
|
|
} |