47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using UnityEngine;
|
|
using AibisDream.FixSystem;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class ExpressionSubSystem : MonoBehaviour
|
|
{
|
|
[Header("子模块设置")]
|
|
public string expressionName; // 表达名称
|
|
public int subSystemIndex; // 子模块索引
|
|
|
|
private ExpressionCableSystem _cableSystem;
|
|
private ExpressionSocket[] _sockets;
|
|
|
|
private void Awake()
|
|
{
|
|
// 自动查找所有子物体中的插槽
|
|
_sockets = GetComponentsInChildren<ExpressionSocket>();
|
|
}
|
|
|
|
public void Initialize(ExpressionCableSystem cableSystem)
|
|
{
|
|
_cableSystem = cableSystem;
|
|
|
|
// 初始化所有插槽
|
|
for (int i = 0; i < _sockets.Length; i++)
|
|
{
|
|
_sockets[i].Initialize(subSystemIndex, i);
|
|
}
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
// 重置所有插槽状态
|
|
foreach (var socket in _sockets)
|
|
{
|
|
socket.PlugOut();
|
|
}
|
|
}
|
|
|
|
public IEnumerable<ExpressionSocket> GetSockets()
|
|
{
|
|
return _sockets;
|
|
}
|
|
}
|
|
} |