Files
aibis-dream/Assets/Scripts/MiniGame/HuoShan/Language/FloatingTextParticle.cs
T
2025-11-12 19:46:16 +08:00

43 lines
1.2 KiB
C#

using UnityEngine;
namespace AibisDream.MiniGame.Language
{
/// <summary>
/// 背景浮动文字粒子
/// </summary>
public class FloatingTextParticle : TextParticle
{
protected override void Awake()
{
base.Awake();
// 背景文字特性
baseAlpha = Random.Range(0.04f, 0.1f); // 0-1 范围的透明度
alpha = baseAlpha;
size = Random.Range(1.5f, 2.5f);
velocity = new Vector2(Random.Range(-0.3f, 0.3f), Random.Range(-0.3f, 0.3f));
changeInterval = Random.Range(0.5f, 0.7f);
if (textMesh != null)
{
textMesh.fontSize = size;
textMesh.color = new Color(0.7f, 0.78f, 1f, alpha);
}
}
protected override void UpdateVisuals()
{
if (textMesh != null)
{
Color color = new Color(0.7f, 0.78f, 1f, alpha);
textMesh.color = color;
}
if (glowSprite != null)
{
glowSprite.color = new Color(0.7f, 0.78f, 1f, alpha * 0.3f);
}
}
}
}