Files
UltimateFishing2020/Assets/Scripts/Assembly-CSharp/ARTNGAME/Skymaster/AeroplaneUserControl4AxisSM.cs
2026-03-04 10:03:45 +08:00

45 lines
1.1 KiB
C#

using System;
using UnityEngine;
namespace ARTNGAME.Skymaster
{
[RequireComponent(typeof(AeroplaneControllerSM))]
public class AeroplaneUserControl4AxisSM : MonoBehaviour
{
public float maxRollAngle = 80f;
public float maxPitchAngle = 80f;
private AeroplaneControllerSM m_Aeroplane;
private float m_Throttle;
private bool m_AirBrakes;
private float m_Yaw;
private void Awake()
{
m_Aeroplane = GetComponent<AeroplaneControllerSM>();
}
private void FixedUpdate()
{
float axis = Input.GetAxis("Mouse X");
float axis2 = Input.GetAxis("Mouse Y");
m_AirBrakes = Input.GetButton("Fire1");
m_Yaw = Input.GetAxis("Horizontal");
m_Throttle = Input.GetAxis("Vertical");
m_Aeroplane.Move(axis, axis2, m_Yaw, m_Throttle, m_AirBrakes);
}
private void AdjustInputForMobileControls(ref float roll, ref float pitch, ref float throttle)
{
float num = roll * maxRollAngle * (MathF.PI / 180f);
float num2 = pitch * maxPitchAngle * (MathF.PI / 180f);
roll = Mathf.Clamp(num - m_Aeroplane.RollAngle, -1f, 1f);
pitch = Mathf.Clamp(num2 - m_Aeroplane.PitchAngle, -1f, 1f);
}
}
}