fix(fix-system): 修正线缆连接点与火花 VFX 参数

This commit is contained in:
2026-07-02 14:52:44 +08:00
parent 7c15663bf2
commit fcd0955ae7
4 changed files with 817 additions and 810 deletions
File diff suppressed because it is too large Load Diff
@@ -61,9 +61,9 @@ namespace AibisDream.FixSystem
_cablePanel.CableReelRef.GetComponent<SpriteRenderer>().sortingLayerName;
_stiffLineRenderer.sortingOrder = _cablePanel.CableReelRef.GetComponent<SpriteRenderer>().sortingOrder - 1;
// 连线起止点
// 连线起止点(末端用 PlugRoot,避免连到插头精灵中心)
_start = _cablePanel.CableRootPos;
_end = _cablePanel.PlugRef.transform;
_end = _cablePanel.PlugRef.PlugRoot;
}
private void InitPoints()
@@ -30,6 +30,8 @@ public class GearFollower : MonoBehaviour
[Header("VFX火花")]
public VisualEffect sparkVFX; // 关联Spark VFX Graph组件
[Tooltip("VFX Graph 暴露的速度 Vector3 参数名,需与 Visual Effect 组件 Inspector 中一致")]
public string sparkVelocityProperty = "Initial Velocity_vector";
public float maxEmissionRate = 50f; // 最大发射速率
public float emissionChangeSpeed = 100f; // 发射速率变化速度
@@ -485,7 +487,10 @@ public class GearFollower : MonoBehaviour
normal = -normal;
}
Vector3 velocity = (Vector3)normal * 10f;
sparkVFX.SetVector3("Initial Velocity1", velocity);
if (!string.IsNullOrEmpty(sparkVelocityProperty) && sparkVFX.HasVector3(sparkVelocityProperty))
{
sparkVFX.SetVector3(sparkVelocityProperty, velocity);
}
}
}
@@ -246,6 +246,9 @@ namespace AibisDream.FixSystem
{
if (IsPlugInSocket()) PlugRef.PullUpSocket();
// 首次拿起时 _end 可能仍是插头 transform,需显式切到线缆连接点
CableRef.SetEndPos(PlugRef.PlugRoot);
// 点击时切换到视觉线缆
SetCableMode(CableMode.Visual);