提交
This commit is contained in:
@@ -79,6 +79,12 @@ namespace AibisDream.FixSystem
|
||||
[SerializeField] private int panelLightBlinkCount = 2;
|
||||
[SerializeField] private Color panelLightColor = Color.white;
|
||||
|
||||
[Header("警报灯设置")]
|
||||
[SerializeField] private Light2D alarmLight;
|
||||
[SerializeField] private float alarmBlinkSpeed = 0.5f;
|
||||
[SerializeField] private Color alarmLightColor = Color.red;
|
||||
private Tween alarmTween; // 用于控制警报灯闪烁的Tween
|
||||
|
||||
[SerializeField] private bool isSystemOn = false; // 系统开关状态
|
||||
|
||||
private LightState currentState = LightState.Normal;
|
||||
@@ -107,6 +113,19 @@ namespace AibisDream.FixSystem
|
||||
Error
|
||||
}
|
||||
|
||||
public RobotECGWave.WaveType GetCurrentWaveType()
|
||||
{
|
||||
return ecgWave?.waveType ?? RobotECGWave.WaveType.RobotECG;
|
||||
}
|
||||
|
||||
public void SetWaveType(RobotECGWave.WaveType waveType)
|
||||
{
|
||||
if (ecgWave != null)
|
||||
{
|
||||
ecgWave.SetWaveType(waveType);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitializeSystemState();
|
||||
@@ -251,8 +270,8 @@ namespace AibisDream.FixSystem
|
||||
targetColor = emergencyColor;
|
||||
breathingSpeed = emergencyBreathingSpeed;
|
||||
waveType = RobotECGWave.WaveType.Noise;
|
||||
environmentColor = emergencyEnvironmentColor;
|
||||
environmentIntensity = emergencyEnvironmentIntensity;
|
||||
environmentColor = normalEnvironmentColor; // 紧急状态不改变环境灯
|
||||
environmentIntensity = normalEnvironmentIntensity;
|
||||
break;
|
||||
default:
|
||||
targetColor = normalColor;
|
||||
@@ -263,6 +282,31 @@ namespace AibisDream.FixSystem
|
||||
break;
|
||||
}
|
||||
|
||||
// 处理警报灯
|
||||
if (alarmLight != null)
|
||||
{
|
||||
if (currentState == LightState.Emergency)
|
||||
{
|
||||
// 启动警报灯闪烁
|
||||
alarmLight.color = alarmLightColor;
|
||||
alarmTween?.Kill();
|
||||
alarmTween = DOTween.To(
|
||||
() => alarmLight.intensity,
|
||||
x => alarmLight.intensity = x,
|
||||
4f,
|
||||
alarmBlinkSpeed
|
||||
)
|
||||
.SetLoops(-1, LoopType.Yoyo)
|
||||
.SetEase(Ease.InOutSine);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 关闭警报灯
|
||||
alarmTween?.Kill();
|
||||
alarmLight.intensity = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"更新灯光状态: {currentState}, 目标颜色: {targetColor}, 呼吸速度: {breathingSpeed}");
|
||||
|
||||
// 更新呼吸灯
|
||||
@@ -482,6 +526,36 @@ namespace AibisDream.FixSystem
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAlarmBlinkSpeed(float speed)
|
||||
{
|
||||
if (speed > 0)
|
||||
{
|
||||
alarmBlinkSpeed = speed;
|
||||
// 如果当前正在闪烁,更新闪烁速度
|
||||
if (currentState == LightState.Emergency && alarmLight != null)
|
||||
{
|
||||
alarmTween?.Kill();
|
||||
alarmTween = DOTween.To(
|
||||
() => alarmLight.intensity,
|
||||
x => alarmLight.intensity = x,
|
||||
1f,
|
||||
alarmBlinkSpeed
|
||||
)
|
||||
.SetLoops(-1, LoopType.Yoyo)
|
||||
.SetEase(Ease.InOutSine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopAlarmLight()
|
||||
{
|
||||
if (alarmLight != null)
|
||||
{
|
||||
alarmTween?.Kill();
|
||||
alarmLight.intensity = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator EnvironmentLightFlickerRoutine()
|
||||
{
|
||||
while (isEnvironmentLightFlickering)
|
||||
@@ -540,6 +614,7 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
// 清理所有Tween
|
||||
breathingTween?.Kill();
|
||||
alarmTween?.Kill();
|
||||
}
|
||||
|
||||
public IEnumerator StartSystem()
|
||||
|
||||
Reference in New Issue
Block a user