根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:
``` docs(readme): 更新文档说明 - 添加项目使用指南 - 完善API接口说明 - 修正错误的配置示例 ``` 注意:由于您提供的code differences部分为空,以上是一个示例模板。当您有具体的代码变更时,请提供详细的变更内容以便生成更准确的commit message。
This commit is contained in:
1 parent
1abd0de32f
commit
a74d1e62d7
43 files changed
+1860
-2
No files matched your search
@@ -0,0 +1,54 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 石头人砸地冲击波 · 触发脚本
|
||||
/// 挂在平躺的 Quad 上,砸地命中帧调用 Play()
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Renderer))]
|
||||
public class ShockwaveRing : MonoBehaviour
|
||||
{
|
||||
[Header("扩散持续时间(秒)")]
|
||||
public float duration = 0.6f;
|
||||
|
||||
[Header("起始缩放(可选,Play 时自动应用)")]
|
||||
public Vector3 startScale = new Vector3(8f, 8f, 1f);
|
||||
|
||||
private Material mat;
|
||||
private float timer = -1f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
// 用 .material 生成独立实例,不影响材质资产
|
||||
mat = GetComponent<Renderer>().material;
|
||||
mat.SetFloat("_Progress", 0f);
|
||||
transform.localScale = startScale;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 外部调用:石头人拳头砸到地面的那一帧触发
|
||||
/// </summary>
|
||||
public void Play()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
timer = 0f;
|
||||
mat.SetFloat("_Progress", 0f);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (timer < 0f) return;
|
||||
|
||||
timer += Time.deltaTime;
|
||||
float progress = Mathf.Clamp01(timer / duration);
|
||||
mat.SetFloat("_Progress", progress);
|
||||
|
||||
// 扩散结束自动隐藏
|
||||
if (progress >= 1f)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
timer = -1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
//(注:内容由AI生成)
|
||||
Reference in new issue
Block a user