Merge branch 'bugfix/合并问题修复' into 'develop'
fix: 冲突合并问题,修复线缆相关 See merge request aibis-dream/aibis-dream!742
This commit is contained in:
@@ -268,7 +268,6 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
var pointerWorldPos = CameraKit.GetMouseWorldPos(pointerData.position);
|
||||
cablePanel.UpdateDragPointer(pointerWorldPos);
|
||||
cablePanel.UpdateDragProximity(pointerWorldPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ namespace AibisDream.FixSystem
|
||||
[Header("灯光系统")]
|
||||
[SerializeField] private CablePanelLight panelLight;
|
||||
|
||||
[Header("拖拽手感")]
|
||||
[SerializeField] private float dragAssistRangeMultiplier = 1.65f;
|
||||
|
||||
public Plug PlugRef => plugRef;
|
||||
public Cable CableRef => cableRef;
|
||||
public PhysicCable PhysicCableRef => physicCableRef;
|
||||
@@ -271,27 +268,7 @@ namespace AibisDream.FixSystem
|
||||
physicCableRef.SetPointer(pointerWorldPos);
|
||||
}
|
||||
|
||||
/// <summary>拖拽中根据与模块距离设置/清除线缆吸附目标;不控制插孔盖开合。</summary>
|
||||
public void UpdateDragProximity(Vector3 pointerWorldPos)
|
||||
{
|
||||
if (physicCableRef == null || BodyModuleSystem?.BodyModules == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float snapRange = BodyModuleSystem.plugSnappingRange;
|
||||
float assistRange = Mathf.Max(snapRange, snapRange * dragAssistRangeMultiplier);
|
||||
if (TryFindClosestModuleWithin(pointerWorldPos, assistRange, out var targetModule))
|
||||
{
|
||||
physicCableRef.SetDragAssistTarget(targetModule.GetSocketPos(), assistRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
physicCableRef.ClearDragAssistTarget();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>结束拖拽:清除吸附并关闭所有插孔盖。</summary>
|
||||
/// <summary>结束拖拽:关闭所有插孔盖。</summary>
|
||||
public void ClearDragHighlight()
|
||||
{
|
||||
BodyModuleSystem?.CloseModuleSlots(null);
|
||||
@@ -323,30 +300,6 @@ namespace AibisDream.FixSystem
|
||||
return BodyModuleSystem.TryFindClosestModule(sourcePos, out targetModule);
|
||||
}
|
||||
|
||||
private bool TryFindClosestModuleWithin(Vector3 sourcePos, float range, out BodyModule targetModule)
|
||||
{
|
||||
float closestDistance = Mathf.Infinity;
|
||||
BodyModule closestModule = null;
|
||||
|
||||
foreach (var bodyModule in BodyModuleSystem.BodyModules)
|
||||
{
|
||||
if (bodyModule == null || !bodyModule.gameObject.activeInHierarchy || !bodyModule.IsAvailable())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance = Vector3.Distance(sourcePos, bodyModule.GetSocketPos().position);
|
||||
if (distance < closestDistance)
|
||||
{
|
||||
closestDistance = distance;
|
||||
closestModule = bodyModule;
|
||||
}
|
||||
}
|
||||
|
||||
targetModule = closestDistance <= range ? closestModule : null;
|
||||
return targetModule != null;
|
||||
}
|
||||
|
||||
public void PullUpCable()
|
||||
{
|
||||
if (isCableRetracted) return;
|
||||
|
||||
Reference in New Issue
Block a user