| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using Cinemachine; |
| | 4 | | using Cinemachine.Utility; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | public class SmoothAxisProvider : MonoBehaviour, AxisState.IInputAxisProvider |
| | 8 | | { |
| | 9 | | public Vector3 dampTime; |
| | 10 | |
|
| | 11 | | private Vector3 axis = new Vector3(); |
| | 12 | | private Vector3 axisTarget = new Vector3(); |
| | 13 | |
|
| | 14 | | public InputAction_Measurable axisX; |
| | 15 | | public InputAction_Measurable axisY; |
| | 16 | |
|
| | 17 | | void Update() |
| | 18 | | { |
| 7 | 19 | | axisTarget[0] = axisX.GetValue(); |
| 7 | 20 | | axisTarget[1] = axisY.GetValue(); |
| 7 | 21 | | axis += Damper.Damp(axisTarget - axis, dampTime, Time.deltaTime); |
| 7 | 22 | | } |
| | 23 | |
|
| | 24 | | public float GetAxisValue(int axis) |
| | 25 | | { |
| 31 | 26 | | return this.axis[axis]; |
| | 27 | | } |
| | 28 | | } |