根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:

```
docs(readme): 更新文档说明

- 添加项目使用指南
- 完善API接口说明
- 修正错误的配置示例
```

注意:由于您提供的code differences部分为空,以上是一个示例模板。当您有具体的代码变更时,请提供详细的变更内容以便生成更准确的commit message。
This commit is contained in:
huadexuan committed 2026-09-30 18:16:20 +08:00
1 parent 1abd0de32f
commit a74d1e62d7
43 files changed
+1860 -2

No files matched your search

+120
View File
@@ -0,0 +1,120 @@
using UnityEngine;
/// <summary>
/// 控制冲击波扩散效果
/// 可通过代码动态调整颜色、大小、速度等参数,实现不同技能的复用
/// </summary>
public class ShockwaveEffect : MonoBehaviour
{
[Header("扩散参数")]
[Tooltip("扩散持续时间(秒)")]
public float duration = 1f;
[Tooltip("扩散完成后是否自动销毁")]
public bool autoDestroy = true;
[Header("运行时可配置参数(可选)")]
[Tooltip("覆盖材质颜色(Alpha=0时不覆盖)")]
public Color overrideColor = new Color(0, 0, 0, 0);
[Tooltip("覆盖扩散半径(<=0时使用Transform.localScale)")]
public float overrideRadius = 0f;
[Tooltip("覆盖圆环粗细(<=0时使用材质默认值)")]
public float overrideRingWidth = 0f;
private Material material;
private float elapsed;
private bool isPlaying;
private Vector3 initialScale;
private void Start()
{
// 获取材质实例(不影响原材质)
var renderer = GetComponent<MeshRenderer>();
if (renderer != null)
{
material = renderer.material; // 自动创建材质实例
// 应用覆盖参数
if (overrideColor.a > 0f)
{
material.SetColor("_RingColor", overrideColor);
}
if (overrideRingWidth > 0f)
{
material.SetFloat("_RingWidth", overrideRingWidth);
}
if (overrideRadius > 0f)
{
// 根据半径计算所需的Scale
// Quad默认1x1,半径0.5,所以 Scale = radius * 2
float scale = overrideRadius * 2f;
transform.localScale = new Vector3(scale, scale, scale);
}
// 从0开始扩散
material.SetFloat("_Progress", 0f);
isPlaying = true;
elapsed = 0f;
}
else
{
Debug.LogWarning("ShockwaveEffect: 找不到MeshRenderer组件");
if (autoDestroy)
{
Destroy(gameObject);
}
}
}
private void Update()
{
if (!isPlaying || material == null)
{
return;
}
elapsed += Time.deltaTime;
float progress = Mathf.Clamp01(elapsed / duration);
// 更新Progress参数(0到1)
material.SetFloat("_Progress", progress);
// 扩散完成
if (progress >= 1f)
{
isPlaying = false;
if (autoDestroy)
{
Destroy(gameObject);
}
}
}
private void OnDestroy()
{
// 清理材质实例
if (material != null)
{
Destroy(material);
}
}
/// <summary>
/// 快捷方法:设置扩散参数
/// </summary>
public void SetupEffect(float radius, float duration, Color color, float ringWidth = 0f)
{
this.overrideRadius = radius;
this.duration = duration;
this.overrideColor = color;
if (ringWidth > 0f)
{
this.overrideRingWidth = ringWidth;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: Wi9Oti2sVXLfnNsZJWEwc8LcWf8W7GlOYV8Ki/YiIZmXc8wu+QEZtEo=
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+19
View File
@@ -16,6 +16,9 @@ public class StoneGolemSkill : UnitSkill
[Min(0f)]
public float skillAnimationDuration = 0f;
[Header("特效")]
public GameObject shockwaveEffectPrefab;
private bool isSkillReady;
public override void ReleaseSkill()
@@ -38,6 +41,22 @@ public class StoneGolemSkill : UnitSkill
return;
}
// 生成扩散光圈特效
if (shockwaveEffectPrefab != null)
{
Vector3 effectPosition = unit.transform.position;
var effectObj = Instantiate(shockwaveEffectPrefab, effectPosition, shockwaveEffectPrefab.transform.rotation);
// 可选:动态配置特效参数(不配置则使用Prefab默认值)
var effect = effectObj.GetComponent<ShockwaveEffect>();
if (effect != null)
{
// 根据技能范围动态设置扩散半径
effect.overrideRadius = skillRadius;
// 可以设置颜色,例如:effect.overrideColor = new Color(1f, 0.8f, 0.2f, 1f);
}
}
unit.ApplyAreaSkillDamage(skillRadius, skillDamage, false);
unit.ApplyAreaStun(skillRadius, stunDuration);
isSkillReady = false;