fix
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -14,6 +15,9 @@ public class StatusLED : ActionAnimator
|
||||
public Material mat_LED_G_On;
|
||||
public Material mat_LED_G_Off;
|
||||
|
||||
Material currentOnMaterial;
|
||||
|
||||
|
||||
public override void AnimationEnd()
|
||||
{
|
||||
SetColor("End");
|
||||
@@ -35,6 +39,28 @@ public class StatusLED : ActionAnimator
|
||||
LED_R.sharedMaterial = mat_LED_R_Off;
|
||||
LED_G.sharedMaterial = mat_LED_G_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)
|
||||
@@ -42,17 +68,20 @@ public class StatusLED : ActionAnimator
|
||||
LED_R.sharedMaterial = mat_LED_R_Off;
|
||||
LED_G.sharedMaterial = mat_LED_G_Off;
|
||||
LED_O.sharedMaterial = mat_LED_O_Off;
|
||||
|
||||
|
||||
switch (progStatus)
|
||||
{
|
||||
case "Start":
|
||||
LED_G.sharedMaterial = mat_LED_G_On;
|
||||
currentOnMaterial = LED_G.sharedMaterial;
|
||||
break;
|
||||
case "End":
|
||||
LED_O.sharedMaterial = mat_LED_O_On;
|
||||
currentOnMaterial = LED_O.sharedMaterial;
|
||||
break;
|
||||
default:
|
||||
LED_O.sharedMaterial = mat_LED_O_On;
|
||||
currentOnMaterial = LED_O.sharedMaterial;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +89,6 @@ public class StatusLED : ActionAnimator
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user