提交
This commit is contained in:
@@ -13,7 +13,7 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
// 注册系统
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
|
||||
|
||||
// 自动获取呼吸灯的SpriteRenderer
|
||||
if (breathingLight != null)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
[Header("呼吸灯设置")]
|
||||
[SerializeField] private Light2D breathingLight;
|
||||
private SpriteRenderer breathingLightSprite;
|
||||
private SpriteRenderer breathingLightSprite;
|
||||
[SerializeField] private float normalBreathingSpeed = 1f;
|
||||
[SerializeField] private float warningBreathingSpeed = 2f;
|
||||
[SerializeField] private float emergencyBreathingSpeed = 3f;
|
||||
@@ -46,7 +46,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
[Header("小灯设置")]
|
||||
[SerializeField] private List<Light2D> smallLights = new List<Light2D>();
|
||||
private List<SpriteRenderer> smallLightSprites = new List<SpriteRenderer>();
|
||||
private List<SpriteRenderer> smallLightSprites = new List<SpriteRenderer>();
|
||||
[SerializeField] private float smallLightBlinkInterval = 0.5f;
|
||||
[SerializeField] private int currentSmallLightIndex = 0;
|
||||
[SerializeField] private Color smallLightDefaultColor = Color.yellow;
|
||||
@@ -138,7 +138,7 @@ namespace AibisDream.FixSystem
|
||||
private void InitializeSystemState()
|
||||
{
|
||||
if (isSystemOn)
|
||||
{
|
||||
{
|
||||
// 系统开启时的初始化
|
||||
if (breathingLight != null)
|
||||
{
|
||||
@@ -179,6 +179,7 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
ecgWave.gameObject.SetActive(true);
|
||||
}
|
||||
environmentLight.intensity = normalEnvironmentIntensity;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,6 +220,12 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
ecgWave.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// 设置环境灯为0.8强度
|
||||
if (environmentLight != null)
|
||||
{
|
||||
environmentLight.intensity = 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool IsSystemOn()
|
||||
@@ -233,7 +240,7 @@ namespace AibisDream.FixSystem
|
||||
public void SetLightState(LightState newState)
|
||||
{
|
||||
if (!isSystemOn) return; // 如果系统未开启,不处理状态变化
|
||||
|
||||
|
||||
if (currentState != newState)
|
||||
{
|
||||
currentState = newState;
|
||||
@@ -344,11 +351,20 @@ namespace AibisDream.FixSystem
|
||||
Debug.LogWarning("ECG波形组件未设置!");
|
||||
}
|
||||
|
||||
// 更新环境灯颜色和强度(独立于系统开关状态)
|
||||
// 更新环境灯颜色和强度
|
||||
if (environmentLight != null)
|
||||
{
|
||||
environmentLight.color = environmentColor;
|
||||
environmentLight.intensity = environmentIntensity;
|
||||
if (isSystemOn)
|
||||
{
|
||||
// 如果系统开启,使用当前状态对应的强度
|
||||
environmentLight.intensity = environmentIntensity;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果系统关闭,使用0.8强度
|
||||
environmentLight.intensity = 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +407,7 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
yield return new WaitForSeconds(operationBlinkInterval);
|
||||
}
|
||||
|
||||
|
||||
// 切换到常亮状态,根据当前LightState设置颜色
|
||||
Color targetColor = currentState switch
|
||||
{
|
||||
@@ -704,16 +720,22 @@ namespace AibisDream.FixSystem
|
||||
// 渐亮
|
||||
DOTween.To(() => panelLight.intensity, x => panelLight.intensity = x, panelLightIntensity, panelLightBlinkDuration * 0.5f)
|
||||
.SetEase(Ease.InOutQuad);
|
||||
DOTween.To(() => environmentLight.intensity, x => environmentLight.intensity = x, normalEnvironmentIntensity, panelLightBlinkDuration * 0.5f)
|
||||
.SetEase(Ease.InOutQuad);
|
||||
yield return new WaitForSeconds(panelLightBlinkDuration);
|
||||
|
||||
|
||||
// 渐暗
|
||||
DOTween.To(() => panelLight.intensity, x => panelLight.intensity = x, 0f, panelLightBlinkDuration * 0.5f)
|
||||
.SetEase(Ease.InOutQuad);
|
||||
DOTween.To(() => environmentLight.intensity, x => environmentLight.intensity = x, 0f, panelLightBlinkDuration * 0.5f)
|
||||
.SetEase(Ease.InOutQuad);
|
||||
yield return new WaitForSeconds(panelLightBlinkDuration);
|
||||
}
|
||||
// 最后渐亮到常亮状态
|
||||
DOTween.To(() => panelLight.intensity, x => panelLight.intensity = x, panelLightIntensity, panelLightBlinkDuration * 0.5f)
|
||||
.SetEase(Ease.InOutQuad);
|
||||
DOTween.To(() => environmentLight.intensity, x => environmentLight.intensity = x, normalEnvironmentIntensity, panelLightBlinkDuration * 0.5f)
|
||||
.SetEase(Ease.InOutQuad);
|
||||
}
|
||||
|
||||
// 5. 设置系统状态为Normal
|
||||
|
||||
Reference in New Issue
Block a user