Files
MI-38/Heli_with_panels/Assets/MFI/IndicatorMFIRange.cs
2022-07-04 13:15:35 +03:00

53 lines
1.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IndicatorMFIRange : MonoBehaviour
{
public float Range1 = 0;
public float Range2 = 0;
public float Range3 = 0;
GameObject Ind2_1, Ind2_2, Ind2_3;
Renderer Fill2_1, Fill2_2, Fill2_3;
/*private void Start()
{
Ind2_1 = GameObject.Find("Indicator2_1_0110");
Ind2_2 = GameObject.Find("Indicator2_2_0110");
Ind2_3 = GameObject.Find("Indicator2_3_0110");
Fill2_1 = GameObject.Find("Indicator2_1_0110fill").GetComponent<Renderer>();
Fill2_2 = GameObject.Find("Indicator2_2_0110fill").GetComponent<Renderer>();
Fill2_3 = GameObject.Find("Indicator2_3_0110fill").GetComponent<Renderer>();
Fill2_1.material.color = Color.red;
Fill2_2.material.color = Color.red;
Fill2_3.material.color = Color.yellow;
}
void Update()
{
if (Ind2_1 == null) return;
Ind2_1.transform.localScale = new Vector3(1f, Range1, 1f);
if (Ind2_1.transform.localScale.y >= 0.2f)
Fill2_1.material.color = Color.yellow;
if (Ind2_1.transform.localScale.y < 0.2f)
Fill2_1.material.color = Color.red;
if (Ind2_1.transform.localScale.y > 0.665f)
Fill2_1.material.color = Color.green;
Ind2_2.transform.localScale = new Vector3(1f, Range2, 1f);
if (Ind2_2.transform.localScale.y >= 0.08f)
Fill2_2.material.color = Color.yellow;
if (Ind2_2.transform.localScale.y < 0.08f)
Fill2_2.material.color = Color.red;
if (Ind2_2.transform.localScale.y > 0.665f)
Fill2_2.material.color = Color.green;
Ind2_3.transform.localScale = new Vector3(1f, Range3, 1f);
if (Ind2_3.transform.localScale.y > 0.665f)
Fill2_3.material.color = Color.green;
if (Ind2_3.transform.localScale.y < 0.665f)
Fill2_3.material.color = Color.yellow;
}*/
}