气泡组件和配置项
This commit is contained in:
@@ -10,8 +10,8 @@ public class ScreenEffectManager : MonoBehaviour
|
||||
{
|
||||
public static ScreenEffectManager Instance { get; private set; }
|
||||
|
||||
public Image blackoutPanel; // 黑屏面板
|
||||
public Image redFlashPanel; // 红色闪烁面板
|
||||
public Image blackoutPanel; // 黑屏面板
|
||||
public Image redFlashPanel; // 红色闪烁面板
|
||||
private float shakeDuration = 0.5f; // 震屏持续时间
|
||||
private float shakeIntensity = 0.04f; // 震屏强度
|
||||
|
||||
@@ -54,7 +54,8 @@ public class ScreenEffectManager : MonoBehaviour
|
||||
[YarnCommand("shakeScreen")]
|
||||
public IEnumerator ShakeScreen()
|
||||
{
|
||||
yield return Camera.main.transform.DOPunchPosition(new Vector3(1, 0, 0) * shakeIntensity, shakeDuration, 8, 1f).WaitForCompletion();
|
||||
yield return Camera.main.transform.DOPunchPosition(new Vector3(1, 0, 0) * shakeIntensity, shakeDuration, 8, 1f)
|
||||
.WaitForCompletion();
|
||||
}
|
||||
|
||||
// 黑屏淡入淡出效果
|
||||
@@ -67,7 +68,8 @@ public class ScreenEffectManager : MonoBehaviour
|
||||
//fadeInSequence.AppendInterval(waitTime);
|
||||
yield return fadeInSequence.WaitForCompletion();
|
||||
}
|
||||
[YarnCommand("fadeOut")]
|
||||
|
||||
[YarnCommand("fadeOut")]
|
||||
public IEnumerator FadeOut(float duration)
|
||||
{
|
||||
Sequence fadeOutSequence = DOTween.Sequence();
|
||||
@@ -91,28 +93,24 @@ public class ScreenEffectManager : MonoBehaviour
|
||||
}
|
||||
|
||||
// 动态调整饱和度
|
||||
public Tween TweenSaturation(float targetSaturation, float duration)
|
||||
{
|
||||
if (colorAdjustments != null)
|
||||
public Tween TweenSaturation(float targetSaturation, float duration)
|
||||
{
|
||||
// 使用 DOTween 创建一个饱和度过渡动画
|
||||
Tween tween = DOTween.To(
|
||||
() => colorAdjustments.saturation.value, // 获取当前饱和度值
|
||||
x => colorAdjustments.saturation.value = x, // 设置新的饱和度值
|
||||
targetSaturation, // 目标饱和度值
|
||||
duration // 过渡持续时间
|
||||
);
|
||||
if (colorAdjustments != null)
|
||||
{
|
||||
// 使用 DOTween 创建一个饱和度过渡动画
|
||||
Tween tween = DOTween.To(
|
||||
() => colorAdjustments.saturation.value, // 获取当前饱和度值
|
||||
x => colorAdjustments.saturation.value = x, // 设置新的饱和度值
|
||||
targetSaturation, // 目标饱和度值
|
||||
duration // 过渡持续时间
|
||||
);
|
||||
|
||||
return tween; // 返回 Tween 对象
|
||||
return tween; // 返回 Tween 对象
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("ColorAdjustments settings not found.");
|
||||
return null; // 如果找不到设置,返回 null
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("ColorAdjustments settings not found.");
|
||||
return null; // 如果找不到设置,返回 null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user