c HUD UI
This commit is contained in:
parent
f5561a9c31
commit
821c769a44
BIN
Assets/Prefab/Material/Frame_225.png
(Stored with Git LFS)
Normal file
BIN
Assets/Prefab/Material/Frame_225.png
(Stored with Git LFS)
Normal file
Binary file not shown.
140
Assets/Prefab/Material/Frame_225.png.meta
Normal file
140
Assets/Prefab/Material/Frame_225.png.meta
Normal file
@ -0,0 +1,140 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ce6115a8bc839b4ea9627d3727d8946
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,13 +1,4 @@
|
||||
//----------------------------------------------
|
||||
// Realistic Car Controller
|
||||
//
|
||||
// Copyright © 2014 - 2023 BoneCracker Games
|
||||
// https://www.bonecrackergames.com
|
||||
// Buğra Özdoğanlar
|
||||
//
|
||||
//----------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -15,7 +6,8 @@ using System.Collections.Generic;
|
||||
/// Receiving inputs from active vehicle on your scene, and feeds dashboard needles, texts, images.
|
||||
/// </summary>
|
||||
[AddComponentMenu("BoneCracker Games/Realistic Car Controller/UI/RCC UI Dashboard Inputs")]
|
||||
public class RCC_DashboardInputs : MonoBehaviour {
|
||||
public class RCC_DashboardInputs : MonoBehaviour
|
||||
{
|
||||
|
||||
public RCC_CarControllerV3 vehicle; // Target vehicle.
|
||||
public bool autoAssignVehicle = true; // Auto assign target vehicle as player vehicle from the RCC_SceneManager.
|
||||
|
@ -1,13 +1,4 @@
|
||||
//----------------------------------------------
|
||||
// Realistic Car Controller
|
||||
//
|
||||
// Copyright © 2014 - 2023 BoneCracker Games
|
||||
// https://www.bonecrackergames.com
|
||||
// Buğra Özdoğanlar
|
||||
//
|
||||
//----------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
|
Binary file not shown.
Binary file not shown.
263
Assets/Scripts/DashboardDisplayPlayer2.cs
Normal file
263
Assets/Scripts/DashboardDisplayPlayer2.cs
Normal file
@ -0,0 +1,263 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Handles RCC Canvas dashboard elements.
|
||||
/// </summary>
|
||||
[AddComponentMenu("BoneCracker Games/Realistic Car Controller/UI/Dashboard Displayer Player2")]
|
||||
[RequireComponent(typeof(DashboardInputPlayer2))]
|
||||
public class DashboardDisplayPlayer2 : MonoBehaviour
|
||||
{
|
||||
|
||||
// Inputs of the dashboard elements.
|
||||
private DashboardInputPlayer2 inputs;
|
||||
private DashboardInputPlayer2 Inputs
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
|
||||
if (inputs == null)
|
||||
inputs = GetComponent<DashboardInputPlayer2>();
|
||||
|
||||
return inputs;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public DisplayType displayType = DisplayType.Full; // Current display type.
|
||||
public enum DisplayType { Full, Customization, TopButtonsOnly, Off }
|
||||
|
||||
public RCC_CarControllerV3 vehicle;
|
||||
public bool autoAssignVehicle = true;
|
||||
|
||||
// Buttons, texts, images, and dropdown menus.
|
||||
[Header("Panels")]
|
||||
public GameObject controllerButtons;
|
||||
public GameObject gauges;
|
||||
public GameObject customizationMenu;
|
||||
|
||||
[Header("Texts")]
|
||||
public Text RPMLabel;
|
||||
public Text KMHLabel;
|
||||
public Text GearLabel;
|
||||
public Text recordingLabel;
|
||||
|
||||
[Header("Images")]
|
||||
//public Image ABS;
|
||||
//public Image ESP;
|
||||
//public Image Park;
|
||||
//public Image Headlights;
|
||||
//public Image leftIndicator;
|
||||
//public Image rightIndicator;
|
||||
//public Image heatIndicator;
|
||||
//public Image fuelIndicator;
|
||||
public Image rpmIndicator;
|
||||
|
||||
[Header("Colors")]
|
||||
public Color color_On = Color.yellow;
|
||||
public Color color_Off = Color.white;
|
||||
|
||||
[Header("Dropdowns")]
|
||||
public Dropdown mobileControllersDropdown;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
if (mobileControllersDropdown)
|
||||
mobileControllersDropdown.interactable = RCC_Settings.Instance.mobileControllerEnabled;
|
||||
|
||||
// Enabling / disabling corresponding elements related to choosen display type.
|
||||
switch (displayType)
|
||||
{
|
||||
|
||||
case DisplayType.Full:
|
||||
|
||||
if (controllerButtons && !controllerButtons.activeSelf)
|
||||
controllerButtons.SetActive(true);
|
||||
|
||||
if (gauges && !gauges.activeSelf)
|
||||
gauges.SetActive(true);
|
||||
|
||||
if (customizationMenu && customizationMenu.activeSelf)
|
||||
customizationMenu.SetActive(false);
|
||||
|
||||
break;
|
||||
|
||||
case DisplayType.Customization:
|
||||
|
||||
if (controllerButtons && controllerButtons.activeSelf)
|
||||
controllerButtons.SetActive(false);
|
||||
|
||||
if (gauges && gauges.activeSelf)
|
||||
gauges.SetActive(false);
|
||||
|
||||
if (customizationMenu && !customizationMenu.activeSelf)
|
||||
customizationMenu.SetActive(true);
|
||||
|
||||
break;
|
||||
|
||||
case DisplayType.TopButtonsOnly:
|
||||
|
||||
if (controllerButtons.activeSelf)
|
||||
controllerButtons.SetActive(false);
|
||||
|
||||
if (gauges.activeSelf)
|
||||
gauges.SetActive(false);
|
||||
|
||||
if (customizationMenu.activeSelf)
|
||||
customizationMenu.SetActive(false);
|
||||
|
||||
break;
|
||||
|
||||
case DisplayType.Off:
|
||||
|
||||
if (controllerButtons && controllerButtons.activeSelf)
|
||||
controllerButtons.SetActive(false);
|
||||
|
||||
if (gauges && gauges.activeSelf)
|
||||
gauges.SetActive(false);
|
||||
|
||||
if (customizationMenu && customizationMenu.activeSelf)
|
||||
customizationMenu.SetActive(false);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
|
||||
// If inputs are not enabled yet, disable it and return.
|
||||
if (!Inputs.enabled)
|
||||
return;
|
||||
|
||||
if (autoAssignVehicle && RCC_SceneManager.Instance.activePlayerVehicle)
|
||||
vehicle = RCC_SceneManager.Instance.activePlayerVehicle;
|
||||
|
||||
if (!vehicle)
|
||||
return;
|
||||
|
||||
if (RPMLabel)
|
||||
RPMLabel.text = Inputs.RPM.ToString("0");
|
||||
|
||||
if (KMHLabel)
|
||||
{
|
||||
|
||||
if (RCC_Settings.Instance.units == RCC_Settings.Units.KMH)
|
||||
KMHLabel.text = Inputs.KMH.ToString("0") + "\nKMH";
|
||||
else
|
||||
KMHLabel.text = (Inputs.KMH * 0.62f).ToString("0") + "\nMPH";
|
||||
|
||||
}
|
||||
|
||||
if (GearLabel)
|
||||
{
|
||||
|
||||
if (!Inputs.NGear && !Inputs.changingGear)
|
||||
GearLabel.text = Inputs.direction == 1 ? (Inputs.Gear + 1).ToString("0") : "R";
|
||||
else
|
||||
GearLabel.text = "N";
|
||||
|
||||
}
|
||||
|
||||
if (recordingLabel)
|
||||
{
|
||||
|
||||
switch (RCC_SceneManager.Instance.recordMode)
|
||||
{
|
||||
|
||||
case RCC_SceneManager.RecordMode.Neutral:
|
||||
|
||||
if (recordingLabel.gameObject.activeSelf)
|
||||
recordingLabel.gameObject.SetActive(false);
|
||||
|
||||
recordingLabel.text = "";
|
||||
|
||||
break;
|
||||
|
||||
case RCC_SceneManager.RecordMode.Play:
|
||||
|
||||
if (!recordingLabel.gameObject.activeSelf)
|
||||
recordingLabel.gameObject.SetActive(true);
|
||||
|
||||
recordingLabel.text = "Playing";
|
||||
recordingLabel.color = Color.green;
|
||||
|
||||
break;
|
||||
|
||||
case RCC_SceneManager.RecordMode.Record:
|
||||
|
||||
if (!recordingLabel.gameObject.activeSelf)
|
||||
recordingLabel.gameObject.SetActive(true);
|
||||
|
||||
recordingLabel.text = "Recording";
|
||||
recordingLabel.color = Color.red;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if (ABS)
|
||||
// ABS.color = Inputs.ABS == true ? color_On : color_Off;
|
||||
|
||||
//if (ESP)
|
||||
// ESP.color = Inputs.ESP == true ? color_On : color_Off;
|
||||
|
||||
//if (Park)
|
||||
// Park.color = Inputs.Park == true ? Color.red : color_Off;
|
||||
|
||||
//if (Headlights)
|
||||
// Headlights.color = Inputs.Headlights == true ? Color.green : color_Off;
|
||||
|
||||
//if (heatIndicator)
|
||||
// heatIndicator.color = vehicle.engineHeat >= 100f ? Color.red : new Color(.1f, 0f, 0f);
|
||||
|
||||
//if (fuelIndicator)
|
||||
// fuelIndicator.color = vehicle.fuelTank < 10f ? Color.red : new Color(.1f, 0f, 0f);
|
||||
|
||||
//if (rpmIndicator)
|
||||
// rpmIndicator.color = vehicle.engineRPM >= vehicle.maxEngineRPM - 500f ? Color.red : new Color(.1f, 0f, 0f);
|
||||
|
||||
//if (leftIndicator && rightIndicator) {
|
||||
|
||||
// switch (Inputs.indicators) {
|
||||
|
||||
// case RCC_CarControllerV3.IndicatorsOn.Left:
|
||||
// leftIndicator.color = new Color(1f, .5f, 0f);
|
||||
// rightIndicator.color = new Color(.5f, .25f, 0f);
|
||||
// break;
|
||||
// case RCC_CarControllerV3.IndicatorsOn.Right:
|
||||
// leftIndicator.color = new Color(.5f, .25f, 0f);
|
||||
// rightIndicator.color = new Color(1f, .5f, 0f);
|
||||
// break;
|
||||
// case RCC_CarControllerV3.IndicatorsOn.All:
|
||||
// leftIndicator.color = new Color(1f, .5f, 0f);
|
||||
// rightIndicator.color = new Color(1f, .5f, 0f);
|
||||
// break;
|
||||
// case RCC_CarControllerV3.IndicatorsOn.Off:
|
||||
// leftIndicator.color = new Color(.5f, .25f, 0f);
|
||||
// rightIndicator.color = new Color(.5f, .25f, 0f);
|
||||
// break;
|
||||
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
public void SetDisplayType(DisplayType _displayType)
|
||||
{
|
||||
|
||||
displayType = _displayType;
|
||||
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/DashboardDisplayPlayer2.cs.meta
Normal file
11
Assets/Scripts/DashboardDisplayPlayer2.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bf3ad1f423536b43ad3dcae666e2b70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
221
Assets/Scripts/DashboardInputPlayer2.cs
Normal file
221
Assets/Scripts/DashboardInputPlayer2.cs
Normal file
@ -0,0 +1,221 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Receiving inputs from active vehicle on your scene, and feeds dashboard needles, texts, images.
|
||||
/// </summary>
|
||||
[AddComponentMenu("BoneCracker Games/Realistic Car Controller/UI/Dashboard Input Player2")]
|
||||
public class DashboardInputPlayer2 : MonoBehaviour
|
||||
{
|
||||
|
||||
public RCC_CarControllerV3 vehiclePlayer2; // Target vehicle.
|
||||
public bool autoAssignVehicle = true; // Auto assign target vehicle as player vehicle from the RCC_SceneManager.
|
||||
|
||||
// Needles.
|
||||
[Header("Needles")]
|
||||
public GameObject RPMNeedle;
|
||||
public GameObject KMHNeedle;
|
||||
public GameObject turboGauge;
|
||||
public GameObject turboNeedle;
|
||||
public GameObject NOSGauge;
|
||||
public GameObject NoSNeedle;
|
||||
public GameObject heatGauge;
|
||||
public GameObject heatNeedle;
|
||||
public GameObject fuelGauge;
|
||||
public GameObject fuelNeedle;
|
||||
|
||||
// Needle rotations.
|
||||
private float RPMNeedleRotation = 0f;
|
||||
private float KMHNeedleRotation = 0f;
|
||||
private float BoostNeedleRotation = 0f;
|
||||
private float NoSNeedleRotation = 0f;
|
||||
private float heatNeedleRotation = 0f;
|
||||
private float fuelNeedleRotation = 0f;
|
||||
|
||||
// Variables of the player vehicle.
|
||||
[HideInInspector] public float RPM;
|
||||
[HideInInspector] public float KMH;
|
||||
[HideInInspector] public int direction = 1;
|
||||
[HideInInspector] public float Gear;
|
||||
[HideInInspector] public bool changingGear = false;
|
||||
[HideInInspector] public bool NGear = false;
|
||||
[HideInInspector] public bool ABS = false;
|
||||
[HideInInspector] public bool ESP = false;
|
||||
[HideInInspector] public bool Park = false;
|
||||
[HideInInspector] public bool Headlights = false;
|
||||
[HideInInspector] public RCC_CarControllerV3.IndicatorsOn indicators;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
if (autoAssignVehicle && RCC_SceneManager.Instance.activePlayerVehicle)
|
||||
vehiclePlayer2 = RCC_SceneManager.Instance.activePlayerVehicle;
|
||||
else
|
||||
vehiclePlayer2 = null;
|
||||
|
||||
// If no any player vehicle, return.
|
||||
if (!vehiclePlayer2)
|
||||
return;
|
||||
|
||||
// If player vehicle is not controllable or controlled by AI, return.
|
||||
if (!vehiclePlayer2.canControl || vehiclePlayer2.externalController)
|
||||
return;
|
||||
|
||||
// If nos gauge is selected, enable or disable gauge related to vehicle.
|
||||
if (NOSGauge)
|
||||
{
|
||||
|
||||
if (vehiclePlayer2.useNOS)
|
||||
{
|
||||
|
||||
if (!NOSGauge.activeSelf)
|
||||
NOSGauge.SetActive(true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (NOSGauge.activeSelf)
|
||||
NOSGauge.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If turbo gauge is selected, enable or disable turbo gauge related to vehicle.
|
||||
if (turboGauge)
|
||||
{
|
||||
|
||||
if (vehiclePlayer2.useTurbo)
|
||||
{
|
||||
|
||||
if (!turboGauge.activeSelf)
|
||||
turboGauge.SetActive(true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (turboGauge.activeSelf)
|
||||
turboGauge.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If heat gauge is selected, enable or disable heat gauge related to vehicle.
|
||||
if (heatGauge)
|
||||
{
|
||||
|
||||
if (vehiclePlayer2.useEngineHeat)
|
||||
{
|
||||
|
||||
if (!heatGauge.activeSelf)
|
||||
heatGauge.SetActive(true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (heatGauge.activeSelf)
|
||||
heatGauge.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If fuel gauge is selected, enable or disable fuel gauge related to vehicle.
|
||||
if (fuelGauge)
|
||||
{
|
||||
|
||||
if (vehiclePlayer2.useFuelConsumption)
|
||||
{
|
||||
|
||||
if (!fuelGauge.activeSelf)
|
||||
fuelGauge.SetActive(true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (fuelGauge.activeSelf)
|
||||
fuelGauge.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Getting variables from the player vehicle.
|
||||
RPM = vehiclePlayer2.engineRPM;
|
||||
KMH = vehiclePlayer2.speed;
|
||||
direction = vehiclePlayer2.direction;
|
||||
Gear = vehiclePlayer2.currentGear;
|
||||
changingGear = vehiclePlayer2.changingGear;
|
||||
NGear = vehiclePlayer2.NGear;
|
||||
ABS = vehiclePlayer2.ABSAct;
|
||||
ESP = vehiclePlayer2.ESPAct;
|
||||
Park = vehiclePlayer2.handbrakeInput > .1f ? true : false;
|
||||
Headlights = vehiclePlayer2.lowBeamHeadLightsOn || vehiclePlayer2.highBeamHeadLightsOn;
|
||||
indicators = vehiclePlayer2.indicatorsOn;
|
||||
|
||||
// If RPM needle is selected, assign rotation of the needle.
|
||||
if (RPMNeedle)
|
||||
{
|
||||
|
||||
RPMNeedleRotation = (vehiclePlayer2.engineRPM / 50f);
|
||||
RPMNeedleRotation = Mathf.Clamp(RPMNeedleRotation, 0f, 180f);
|
||||
RPMNeedle.transform.eulerAngles = new Vector3(RPMNeedle.transform.eulerAngles.x, RPMNeedle.transform.eulerAngles.y, -RPMNeedleRotation);
|
||||
|
||||
}
|
||||
|
||||
// If KMH needle is selected, assign rotation of the needle.
|
||||
if (KMHNeedle)
|
||||
{
|
||||
|
||||
if (RCC_Settings.Instance.units == RCC_Settings.Units.KMH)
|
||||
KMHNeedleRotation = (vehiclePlayer2.speed);
|
||||
else
|
||||
KMHNeedleRotation = (vehiclePlayer2.speed * 0.62f);
|
||||
|
||||
KMHNeedle.transform.eulerAngles = new Vector3(KMHNeedle.transform.eulerAngles.x, KMHNeedle.transform.eulerAngles.y, -KMHNeedleRotation);
|
||||
|
||||
}
|
||||
|
||||
// If turbo needle is selected, assign rotation of the needle.
|
||||
if (turboNeedle)
|
||||
{
|
||||
|
||||
BoostNeedleRotation = (vehiclePlayer2.turboBoost / 30f) * 270f;
|
||||
turboNeedle.transform.eulerAngles = new Vector3(turboNeedle.transform.eulerAngles.x, turboNeedle.transform.eulerAngles.y, -BoostNeedleRotation);
|
||||
|
||||
}
|
||||
|
||||
// If nos needle is selected, assign rotation of the needle.
|
||||
if (NoSNeedle)
|
||||
{
|
||||
|
||||
NoSNeedleRotation = (vehiclePlayer2.NoS / 100f) * 270f;
|
||||
NoSNeedle.transform.eulerAngles = new Vector3(NoSNeedle.transform.eulerAngles.x, NoSNeedle.transform.eulerAngles.y, -NoSNeedleRotation);
|
||||
|
||||
}
|
||||
|
||||
// If heat needle is selected, assign rotation of the needle.
|
||||
if (heatNeedle)
|
||||
{
|
||||
|
||||
heatNeedleRotation = (vehiclePlayer2.engineHeat / 110f) * 270f;
|
||||
heatNeedle.transform.eulerAngles = new Vector3(heatNeedle.transform.eulerAngles.x, heatNeedle.transform.eulerAngles.y, -heatNeedleRotation);
|
||||
|
||||
}
|
||||
|
||||
// If fuel needle is selected, assign rotation of the needle.
|
||||
if (fuelNeedle)
|
||||
{
|
||||
|
||||
fuelNeedleRotation = (vehiclePlayer2.fuelTank / vehiclePlayer2.fuelTankCapacity) * 270f;
|
||||
fuelNeedle.transform.eulerAngles = new Vector3(fuelNeedle.transform.eulerAngles.x, fuelNeedle.transform.eulerAngles.y, -fuelNeedleRotation);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/DashboardInputPlayer2.cs.meta
Normal file
11
Assets/Scripts/DashboardInputPlayer2.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0567eca99e97144f9dfbacaa29d1c58
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user