This commit is contained in:
parent
6b6ecf593e
commit
0ca8d49c68
|
|
@ -52,6 +52,12 @@ namespace EVP
|
||||||
// 将输入值从 0-100 范围映射到 0-1 范围
|
// 将输入值从 0-100 范围映射到 0-1 范围
|
||||||
xxxx = Mathf.Clamp(value, 0, 100) / 100.0f;
|
xxxx = Mathf.Clamp(value, 0, 100) / 100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float steerInput;
|
||||||
|
public float forwardInput;
|
||||||
|
public float reverseInput;
|
||||||
|
|
||||||
|
|
||||||
// public float xxxxxx;
|
// public float xxxxxx;
|
||||||
void FixedUpdate()
|
void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
|
@ -59,11 +65,11 @@ namespace EVP
|
||||||
|
|
||||||
// Read the user input
|
// Read the user input
|
||||||
|
|
||||||
float steerInput = Mathf.Clamp(Input.GetAxis(steerAxis), -1.0f, 1.0f);
|
steerInput = Mathf.Clamp(Input.GetAxis(steerAxis), -1.0f, 1.0f);
|
||||||
float handbrakeInput = Mathf.Clamp01(Input.GetAxis(handbrakeAxis));
|
float handbrakeInput = Mathf.Clamp01(Input.GetAxis(handbrakeAxis));
|
||||||
|
|
||||||
float forwardInput = 0.0f;
|
forwardInput = 0.0f;
|
||||||
float reverseInput = 0.0f;
|
reverseInput = 0.0f;
|
||||||
// Debug.Log("前轮控制左右的参数----->" + steerInput);
|
// Debug.Log("前轮控制左右的参数----->" + steerInput);
|
||||||
|
|
||||||
if (throttleAndBrakeInput == ThrottleAndBrakeInput.SeparateAxes)
|
if (throttleAndBrakeInput == ThrottleAndBrakeInput.SeparateAxes)
|
||||||
|
|
@ -79,9 +85,9 @@ namespace EVP
|
||||||
// forwardInput = Mathf.Clamp01(xxxx);
|
// forwardInput = Mathf.Clamp01(xxxx);
|
||||||
// Debug.Log(Mathf.Clamp01(xxxx));
|
// Debug.Log(Mathf.Clamp01(xxxx));
|
||||||
// forwardInput = xxxxxx;
|
// forwardInput = xxxxxx;
|
||||||
// Debug.Log("前轮控制左右的参数----->" + steerInput);
|
Debug.Log("前轮控制左右的参数----->" + steerInput);
|
||||||
// Debug.Log("往前的参数----->" + forwardInput);
|
Debug.Log("往前的参数----->" + forwardInput);
|
||||||
// Debug.Log("往后的参数----->" + reverseInput);
|
Debug.Log("往后的参数----->" + reverseInput);
|
||||||
// Translate forward/reverse to vehicle input
|
// Translate forward/reverse to vehicle input
|
||||||
|
|
||||||
float throttleInput = 0.0f;
|
float throttleInput = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -397307,6 +397307,18 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: b4decbca4aaf413abd074ba71736660a, type: 3}
|
m_Script: {fileID: 11500000, guid: b4decbca4aaf413abd074ba71736660a, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!114 &1276762325 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 11461196, guid: 4292160a5e1fde347934ac660b2c5d30,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 2037673174}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1276762317}
|
||||||
|
m_Enabled: 0
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ca79ba03ebacd504783b096c3667cfbd, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!114 &1276762328
|
--- !u!114 &1276762328
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -397342,6 +397354,8 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
turnSignalController: {fileID: 1276762328}
|
turnSignalController: {fileID: 1276762328}
|
||||||
vehicleController: {fileID: 2037673176}
|
vehicleController: {fileID: 2037673176}
|
||||||
|
vehicleStandardInput: {fileID: 1276762325}
|
||||||
|
accidentManager: {fileID: 1323185945}
|
||||||
cam1: {fileID: 1136185827}
|
cam1: {fileID: 1136185827}
|
||||||
cam2: {fileID: 1785647646}
|
cam2: {fileID: 1785647646}
|
||||||
menuUI: {fileID: 1648579876}
|
menuUI: {fileID: 1648579876}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ namespace Script.Manaegr
|
||||||
{
|
{
|
||||||
public class CarInputManager : MonoBehaviour
|
public class CarInputManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
public TurnSignalController turnSignalController;
|
public TurnSignalController turnSignalController;
|
||||||
public VehicleController vehicleController;
|
public VehicleController vehicleController;
|
||||||
|
public VehicleStandardInput vehicleStandardInput;
|
||||||
|
public AccidentManager accidentManager;
|
||||||
|
|
||||||
public GameObject cam1;
|
public GameObject cam1;
|
||||||
public GameObject cam2;
|
public GameObject cam2;
|
||||||
|
|
@ -61,6 +61,7 @@ namespace Script.Manaegr
|
||||||
cam2.SetActive(false);
|
cam2.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//雨刮器
|
//雨刮器
|
||||||
if (Input.GetKeyDown(KeyCode.I))
|
if (Input.GetKeyDown(KeyCode.I))
|
||||||
{
|
{
|
||||||
|
|
@ -89,8 +90,25 @@ namespace Script.Manaegr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vehicleStandardInput.forwardInput >= 1)
|
||||||
|
{
|
||||||
|
if (vehicleStandardInput.steerInput >= 1) //右
|
||||||
|
{
|
||||||
|
if (turnSignalController.turnSignalState != TurnSignalState.右转向)
|
||||||
|
{
|
||||||
|
accidentManager.PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
|
||||||
|
accidentManager.uis.transform.Find("UI/转向").gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (vehicleStandardInput.steerInput <= -1) //左
|
||||||
|
{
|
||||||
|
if (turnSignalController.turnSignalState != TurnSignalState.左转向)
|
||||||
|
{
|
||||||
|
accidentManager.PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
|
||||||
|
accidentManager.uis.transform.Find("UI/转向").gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue