using UnityEngine; using AibisDream.FixSystem; namespace AibisDream { public class ExpressionPowerSource : MonoBehaviour { [Header("插头设置")] public Transform[] plugGroups; // 在编辑器中直接拖拽设置插头组 private void Start() { // 初始化每个插头组 foreach (var group in plugGroups) { var plug = group.GetComponentInChildren(); var cable = group.GetComponentInChildren(); var rootPos = group.Find("CableRoot"); if (plug != null && cable != null && rootPos != null) { cable.Initialize(rootPos, plug.transform.GetChild(0)); plug.SetCable(cable); } else { Debug.LogWarning($"插头组 {group.name} 缺少必要组件"); } } } public void Reset() { // 重置所有插头 foreach (var group in plugGroups) { var plug = group.GetComponentInChildren(); if (plug != null) { plug.ReturnToStartPosition(); } } } } }