2025-10-19 19:38:52 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
using System.Collections.Generic;
|
2025-10-22 17:34:58 +08:00
|
|
|
using Script.Gameplay.Connect;
|
2025-10-19 19:38:52 +08:00
|
|
|
|
2025-10-22 17:34:58 +08:00
|
|
|
namespace Script.Gameplay.Interface
|
2025-10-19 19:38:52 +08:00
|
|
|
{
|
2025-10-22 17:34:58 +08:00
|
|
|
public interface IConnectable
|
2025-10-19 19:38:52 +08:00
|
|
|
{
|
2025-10-22 17:34:58 +08:00
|
|
|
public bool IsEnableConnect { get; set; }
|
2025-10-19 19:38:52 +08:00
|
|
|
Vector3 GetPosition(); // 获取连接点位置
|
2025-10-20 19:40:55 +08:00
|
|
|
GameObject GetGameObject(); // 获取连接点物体
|
2025-10-19 19:38:52 +08:00
|
|
|
string GetConnectableName(); // 获取连接点名称
|
2025-10-20 19:40:55 +08:00
|
|
|
public List<ConnectionLine> ConnectionLines { get; set; }
|
2025-10-27 10:31:01 +08:00
|
|
|
|
|
|
|
|
// public static List<GameObject> GetConnectedGameObjects(GameObject sender)
|
|
|
|
|
// {
|
|
|
|
|
// IConnectable connectable = sender.GetComponent<IConnectable>();
|
|
|
|
|
// List<GameObject> connectedObjects = new List<GameObject>();
|
|
|
|
|
// if (connectable != null)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (var target in connectable.ConnectionLines)
|
|
|
|
|
// {
|
|
|
|
|
// if (target != null && target.PointA != null && target.PointB != null)
|
|
|
|
|
// {
|
|
|
|
|
// // 排除掉AB点中与sender相同的点
|
|
|
|
|
// if (target.PointA.GetGameObject() != sender)
|
|
|
|
|
// {
|
|
|
|
|
// connectedObjects.Add(target.PointA.GetGameObject());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (target.PointB.GetGameObject() != sender)
|
|
|
|
|
// {
|
|
|
|
|
// connectedObjects.Add(target.PointB.GetGameObject());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return connectedObjects;
|
|
|
|
|
// }
|
2025-10-19 19:38:52 +08:00
|
|
|
}
|
|
|
|
|
}
|