This commit is contained in:
lwj
2025-07-17 18:28:24 +09:00
parent 4ede5816de
commit 81e45788cc

View File

@@ -1,3 +1,4 @@
using System.Collections;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
@@ -14,6 +15,9 @@ public class StatusLED : ActionAnimator
public Material mat_LED_G_On; public Material mat_LED_G_On;
public Material mat_LED_G_Off; public Material mat_LED_G_Off;
Material currentOnMaterial;
public override void AnimationEnd() public override void AnimationEnd()
{ {
SetColor("End"); SetColor("End");
@@ -35,6 +39,28 @@ public class StatusLED : ActionAnimator
LED_R.sharedMaterial = mat_LED_R_Off; LED_R.sharedMaterial = mat_LED_R_Off;
LED_G.sharedMaterial = mat_LED_G_Off; LED_G.sharedMaterial = mat_LED_G_Off;
LED_O.sharedMaterial = mat_LED_O_Off; LED_O.sharedMaterial = mat_LED_O_Off;
Invoke("Flicker", 1f);
}
bool isOn = false;
public void Flicker()
{
if (currentOnMaterial == null)
return;
if (isOn == false)
{
isOn = true;
currentOnMaterial.EnableKeyword("_Emission");
}
else if (isOn == true)
{
isOn = false;
currentOnMaterial.DisableKeyword("_Emission");
}
} }
private void SetColor(string progStatus, string status = null) private void SetColor(string progStatus, string status = null)
@@ -47,12 +73,15 @@ public class StatusLED : ActionAnimator
{ {
case "Start": case "Start":
LED_G.sharedMaterial = mat_LED_G_On; LED_G.sharedMaterial = mat_LED_G_On;
currentOnMaterial = LED_G.sharedMaterial;
break; break;
case "End": case "End":
LED_O.sharedMaterial = mat_LED_O_On; LED_O.sharedMaterial = mat_LED_O_On;
currentOnMaterial = LED_O.sharedMaterial;
break; break;
default: default:
LED_O.sharedMaterial = mat_LED_O_On; LED_O.sharedMaterial = mat_LED_O_On;
currentOnMaterial = LED_O.sharedMaterial;
break; break;
} }
} }