LED: when not using ipc automatic using fade effect; swap the hand of local-motion turn and rotate
This commit is contained in:
@@ -8,7 +8,8 @@ public class LightManager : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> Lights = new List<GameObject>();
|
||||
List<Material> Materials = new List<Material>();
|
||||
public static bool useIPC = true;
|
||||
public static bool useIPC = false;
|
||||
public static bool useIPC_Config = true;
|
||||
static Texture2D RGBColor2D;
|
||||
|
||||
public static MemoryMappedFile sharedBuffer;
|
||||
@@ -20,9 +21,9 @@ public class LightManager : MonoBehaviour
|
||||
private void Start()
|
||||
{
|
||||
if (JsonConfiguration.HasKey("useIPC"))
|
||||
useIPC = JsonConfiguration.GetBoolean("useIPC");
|
||||
useIPC_Config = JsonConfiguration.GetBoolean("useIPC");
|
||||
else
|
||||
JsonConfiguration.SetBoolean("useIPC", useIPC);
|
||||
JsonConfiguration.SetBoolean("useIPC", useIPC_Config);
|
||||
|
||||
for (int i = 0; i < Lights.Count; i++)
|
||||
Materials.Add(Lights[i].GetComponent<Renderer>().material);
|
||||
@@ -37,9 +38,18 @@ public class LightManager : MonoBehaviour
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (!useIPC_Config)
|
||||
CheckIPCState();
|
||||
if (useIPC)
|
||||
UpdateLED();
|
||||
}
|
||||
private void CheckIPCState()
|
||||
{
|
||||
if (RGBColor2D.GetPixel(0 , 0).a == 0)
|
||||
useIPC = false;
|
||||
else
|
||||
useIPC = true;
|
||||
}
|
||||
private void InitializeIPC(string sharedMemoryName, int sharedMemorySize)
|
||||
{
|
||||
MemoryMappedFileSecurity CustomSecurity = new MemoryMappedFileSecurity();
|
||||
@@ -85,6 +95,7 @@ public class LightManager : MonoBehaviour
|
||||
if (State)
|
||||
{
|
||||
Materials[Area].SetColor("_EmissionColor", new Color(1f, 1f, 1f, 1f));
|
||||
Materials[Area].SetColor("_EmissionColor2", new Color(1f, 1f, 1f, 1f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,6 +111,7 @@ public class LightManager : MonoBehaviour
|
||||
{
|
||||
float p = 1 - time / FadeDuration;
|
||||
mat.SetColor("_EmissionColor", new Color(p, p, p, 1f));
|
||||
mat.SetColor("_EmissionColor2", new Color(p, p, p, 1f));
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user