96 lines
2.2 KiB
C#
96 lines
2.2 KiB
C#
using System;
|
|
using EVP;
|
|
using UnityEngine;
|
|
|
|
namespace Script.Manaegr
|
|
{
|
|
public class CarInputManager : MonoBehaviour
|
|
{
|
|
|
|
public TurnSignalController turnSignalController;
|
|
public VehicleController vehicleController;
|
|
|
|
|
|
public GameObject cam1;
|
|
public GameObject cam2;
|
|
|
|
public GameObject menuUI;
|
|
public GameObject carInfoUI;
|
|
|
|
|
|
public AnimationController ygq;
|
|
|
|
private bool isYgq = false;
|
|
|
|
public void Init()
|
|
{
|
|
vehicleController.maxSpeedForward = 11;
|
|
carInfoUI.SetActive(true);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
//左转向
|
|
if (Input.GetKeyDown(KeyCode.J))
|
|
{
|
|
turnSignalController.SetSignal(1);
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.K))
|
|
{
|
|
turnSignalController.SetSignal(3);
|
|
}
|
|
|
|
if (Input.GetKeyDown(KeyCode.L))
|
|
{
|
|
turnSignalController.SetSignal(2);
|
|
}
|
|
|
|
|
|
//切换车内视角
|
|
if (Input.GetKeyDown(KeyCode.U))
|
|
{
|
|
if (cam1.activeInHierarchy)
|
|
{
|
|
cam1.SetActive(false);
|
|
cam2.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
cam1.SetActive(true);
|
|
cam2.SetActive(false);
|
|
}
|
|
}
|
|
//雨刮器
|
|
if (Input.GetKeyDown(KeyCode.I))
|
|
{
|
|
if (!isYgq)
|
|
{
|
|
isYgq = true;
|
|
ygq.PlayAnimation("donghua");
|
|
}
|
|
else
|
|
{
|
|
isYgq = false;
|
|
ygq.StopAnimationLoop();
|
|
}
|
|
}
|
|
|
|
//菜单
|
|
if (Input.GetKeyDown(KeyCode.Escape))
|
|
{
|
|
if (menuUI.activeInHierarchy)
|
|
{
|
|
menuUI.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
menuUI.SetActive(true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
} |