1 using System.Collections;
2 using System.Collections.Generic;
5 using System.ComponentModel;
15 [Header(
"Tachometer Properties")]
16 [Tooltip(
"Drag and drop Engine Here")]
19 [Tooltip(
"Drag and drop pointer Here")]
20 public RectTransform pointer;
21 public float maxRPMIntachometer = 3500f;
23 private float smoothrotation;
26 #region Builtin methods
28 engine = GameObject.Find(CommonFunctions.ActiveAirplane).GetComponent<
AC_Airplane_Engine>();
32 #region Interface Methods
40 float normalizedRPM = Mathf.InverseLerp(0f, (
float)CommonFunctions.airplanePreset[CommonFunctions.activeAirplane+
"/maxRPM"] , engine.CurrentRPM);
41 float radialspeed = 360f * normalizedRPM;
43 smoothrotation = Mathf.Lerp(smoothrotation, radialspeed, Time.deltaTime*0.1f);
44 pointer.rotation = Quaternion.Euler(0f,0f,-smoothrotation);