1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2025-02-20 20:31:00 +01:00

fix led power

This commit is contained in:
xpeng 2022-02-21 00:57:30 +01:00
parent b16fbd79f1
commit 09d372437b

View File

@ -14,7 +14,7 @@ public class LedSerial : MonoBehaviour
byte recivData;
int packLeng = 0;
public Light[] Lights;
public float LightIntensity = 1;
public float LightIntensity = 3f;
Color32 PrevFadeColor;
bool headState = false;
void Start()
@ -26,13 +26,14 @@ public class LedSerial : MonoBehaviour
{
//ReadPack();
ReadData();
FixLedPower();
StartCoroutine(FixLedPower());
}
void FixLedPower()
IEnumerator FixLedPower()
{
for (int i = 0; i < 8; i++)
{
Lights[i].intensity = LightIntensity / 2 * ((Lights[i].color.r + Lights[i].color.g + Lights[i].color.b)/3);
Lights[i].intensity = LightIntensity / (Lights[i].color.r + Lights[i].color.g + Lights[i].color.b) +0.1f;
yield return null;
}
}
private void ReadPack()