feat(Cycle):实现循环提前检测,修复交互提示消失,按键绑定的事件在重启的时候没能正确,触发循环的提前检测有错误
This commit is contained in:
@@ -11,5 +11,31 @@ namespace Script.Gameplay.Interface
|
||||
GameObject GetGameObject(); // 获取连接点物体
|
||||
string GetConnectableName(); // 获取连接点名称
|
||||
public List<ConnectionLine> ConnectionLines { get; set; }
|
||||
|
||||
// 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;
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.Gameplay.Interface
|
||||
{
|
||||
public interface ISignalSender
|
||||
{
|
||||
public bool IsEnableSendSignal { get; set; }
|
||||
public void SendSignal(bool active, GameObject sender);
|
||||
|
||||
public static bool IsSendToSignalSender(GameObject sender)
|
||||
{
|
||||
IConnectable connectable = sender.GetComponent<IConnectable>();
|
||||
// 从连接线中查找是否有连接到ISignalSender的对象
|
||||
if (connectable != null)
|
||||
{
|
||||
foreach (var connectionLine in connectable.ConnectionLines)
|
||||
{
|
||||
if (connectionLine != null)
|
||||
{
|
||||
GameObject targetObject = null;
|
||||
if (connectionLine.PointA.GetGameObject() == sender)
|
||||
{
|
||||
targetObject = connectionLine.PointB.GetGameObject();
|
||||
}
|
||||
else if (connectionLine.PointB.GetGameObject() == sender)
|
||||
{
|
||||
targetObject = connectionLine.PointA.GetGameObject();
|
||||
}
|
||||
|
||||
if (targetObject != null && targetObject.GetComponent<ISignalSender>().IsEnableSendSignal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user