diff --git a/Assets/Render/Renderer2Dtest.asset b/Assets/Render/Renderer2Dtest.asset index 789a77197..751a12ed4 100644 --- a/Assets/Render/Renderer2Dtest.asset +++ b/Assets/Render/Renderer2Dtest.asset @@ -1053,15 +1053,19 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 _filter: - - 0.007228916 - - 0.043749984 - - 0.12409639 - - 0.20444278 - - 0.24096388 - - 0.20444278 - - 0.12409639 - - 0.043749984 - - 0.007228916 + - 0.0048309183 + - 0.016401261 + - 0.04532712 + - 0.08293076 + - 0.12053438 + - 0.14946026 + - 0.1610306 + - 0.14946026 + - 0.12053438 + - 0.08293076 + - 0.04532712 + - 0.016401261 + - 0.0048309183 --- !u!114 &-6086986437317696584 MonoBehaviour: m_ObjectHideFlags: 3 diff --git a/Assets/Scenes/PeipeiFixScene.unity b/Assets/Scenes/PeipeiFixScene.unity index 889aa805d..d26eef9d8 100644 --- a/Assets/Scenes/PeipeiFixScene.unity +++ b/Assets/Scenes/PeipeiFixScene.unity @@ -4630,6 +4630,71 @@ Material: - _ShadowColor: {r: 0, g: 0, b: 0, a: 1} - _ShineColor: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] +--- !u!1001 &205914928 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1236037239} + m_Modifications: + - target: {fileID: 3614166255594274803, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_Name + value: PhysicLinePrefabNew + objectReference: {fileID: 0} + - target: {fileID: 8979707155830308861, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_SortingLayer + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 8979707155830308861, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_SortingLayerID + value: 1016946085 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} --- !u!21 &209854923 Material: serializedVersion: 8 @@ -7898,6 +7963,37 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 388141010} m_CullTransparentMesh: 1 +--- !u!1 &395292228 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 395292229} + m_Layer: 0 + m_Name: Start + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &395292229 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 395292228} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.43, y: 0.19, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1236037239} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &401033349 GameObject: m_ObjectHideFlags: 0 @@ -8118,6 +8214,11 @@ SpriteMask: m_BackSortingOrder: 0 m_IsCustomRangeActive: 0 m_SpriteSortPoint: 0 +--- !u!4 &453375097 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9034087187549040666, guid: befc2e1cb50eae541870ccb46e98e3ee, type: 3} + m_PrefabInstance: {fileID: 205914928} + m_PrefabAsset: {fileID: 0} --- !u!1 &466676742 GameObject: m_ObjectHideFlags: 0 @@ -19389,6 +19490,56 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1235255814} m_CullTransparentMesh: 1 +--- !u!1 &1236037238 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1236037239} + - component: {fileID: 1236037240} + m_Layer: 0 + m_Name: PhysicCable + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1236037239 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1236037238} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -1.2000008, y: 0.52, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 453375097} + - {fileID: 395292229} + - {fileID: 1248774369} + m_Father: {fileID: 1940605071} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1236037240 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1236037238} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc956cb4eb967a4498d7eeef575ceb63, type: 3} + m_Name: + m_EditorClassIdentifier: + StartTranform: {fileID: 395292229} + endTransform: {fileID: 1248774369} + physicLine: {fileID: 0} --- !u!1 &1244183432 GameObject: m_ObjectHideFlags: 0 @@ -19464,6 +19615,37 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1244183432} m_CullTransparentMesh: 1 +--- !u!1 &1248774368 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1248774369} + m_Layer: 0 + m_Name: End + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1248774369 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1248774368} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.11, y: -1.89, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1236037239} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1255230568 GameObject: m_ObjectHideFlags: 0 @@ -29369,6 +29551,11 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1940301553} m_CullTransparentMesh: 1 +--- !u!4 &1940605071 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2117906688623379083, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} + m_PrefabInstance: {fileID: 6045551082333026152} + m_PrefabAsset: {fileID: 0} --- !u!1 &1944658449 GameObject: m_ObjectHideFlags: 0 @@ -34259,6 +34446,14 @@ PrefabInstance: propertyPath: m_LocalPosition.y value: -0.013 objectReference: {fileID: 0} + - target: {fileID: 1743353464033058114, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} + propertyPath: m_LocalPosition.x + value: -0.62 + objectReference: {fileID: 0} + - target: {fileID: 1743353464033058114, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} + propertyPath: m_LocalPosition.y + value: -2.72 + objectReference: {fileID: 0} - target: {fileID: 1953141088643421057, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} propertyPath: m_Color.b value: 0 @@ -34279,6 +34474,10 @@ PrefabInstance: propertyPath: m_LocalPosition.y value: -0.89 objectReference: {fileID: 0} + - target: {fileID: 2195061089379433005, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2411966172391820548, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} propertyPath: m_IsActive value: 1 @@ -34287,6 +34486,10 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 2974144504474559753, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3058962797372916513, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} propertyPath: m_AnchoredPosition.x value: -1.01 @@ -34556,6 +34759,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 2309837242789316790, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} insertIndex: -1 addedObject: {fileID: 2085860891} + - targetCorrespondingSourceObject: {fileID: 2117906688623379083, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} + insertIndex: 0 + addedObject: {fileID: 1236037239} m_AddedComponents: - targetCorrespondingSourceObject: {fileID: 4445889917739518717, guid: 92aec29b557d59a4ca5363aadd06c7bb, type: 3} insertIndex: -1 @@ -34651,7 +34857,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4214753503693131867, guid: 13f00ab6092291d49a9312e52873d80b, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 7037918505330246345, guid: 13f00ab6092291d49a9312e52873d80b, type: 3} propertyPath: field of view diff --git a/Assets/Scripts/FixSystem/Cable/PhysicCable.cs b/Assets/Scripts/FixSystem/Cable/PhysicCable.cs new file mode 100644 index 000000000..ad892c234 --- /dev/null +++ b/Assets/Scripts/FixSystem/Cable/PhysicCable.cs @@ -0,0 +1,27 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PhysicCable : MonoBehaviour +{ + public Transform StartTranform; + + public Transform endTransform; + public PhysicLineSegment physicLine; + // Start is called before the first frame update + void Start() + { + physicLine=transform.GetChild(0).GetComponent(); + } + public void Init() + { + + physicLine.Initialize(StartTranform.position,endTransform.position); + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/FixSystem/Cable/PhysicCable.cs.meta b/Assets/Scripts/FixSystem/Cable/PhysicCable.cs.meta new file mode 100644 index 000000000..161b74836 --- /dev/null +++ b/Assets/Scripts/FixSystem/Cable/PhysicCable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc956cb4eb967a4498d7eeef575ceb63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/FixSystem/Line/PhysicLineSegment.cs b/Assets/Scripts/FixSystem/Line/PhysicLineSegment.cs index d7fae069e..6867684e8 100644 --- a/Assets/Scripts/FixSystem/Line/PhysicLineSegment.cs +++ b/Assets/Scripts/FixSystem/Line/PhysicLineSegment.cs @@ -7,48 +7,45 @@ public class PhysicLineSegment : MonoBehaviour public float segmentSpacing = 0.1f; public int k = 30; - public Vector3 start; - public Vector3 end; - - private List particles = new List(); + private Vector3 start; + private Vector3 end; + public List particles = new List(); private List sticks = new List(); [HideInInspector] public LineRenderer lineRenderer; - private int segmentCount; + public int segmentCount; public float gravity = -9.8f; -public void Initialize(Vector3 start, Vector3 end) -{ - this.start = start; - this.end = end; - //originalLength = Vector3.Distance(start, end); + private float originalLength; - // Calculate the number of segments and the spacing between them - segmentCount = Mathf.RoundToInt(Vector3.Distance(start, end) / segmentSpacing); - lineRenderer = GetComponent(); - - // Initialize particles - for (int i = 0; i < segmentCount; i++) + public void Initialize(Vector3 start, Vector3 end) { - // Calculate the position of the segment - var particle = new VerletParticle(Vector3.Lerp(start, end, i / (float)segmentCount)); - - particles.Add(particle); + this.start = start; + this.end = end; + originalLength = Vector3.Distance(start, end); + + segmentCount = Mathf.RoundToInt(Vector3.Distance(start, end) / segmentSpacing * 1.2f); + lineRenderer = GetComponent(); + + // Initialize particles + for (int i = 0; i < segmentCount; i++) + { + var particle = new VerletParticle(Vector3.Lerp(start, end, i / (float)segmentCount)); + particles.Add(particle); + } + + // Initialize sticks + for (int i = 0; i < segmentCount - 1; i++) + { + sticks.Add(new VerletStick(particles[i], particles[i + 1], segmentSpacing)); + } + + // Lock the first particle + particles[0].isLocked = true; + + lineRenderer.positionCount = segmentCount; } - // Initialize sticks - for (int i = 0; i < segmentCount - 1; i++) - { - sticks.Add(new VerletStick(particles[i], particles[i + 1], segmentSpacing)); - } - - // Lock the first particle - particles[0].isLocked = true; - - lineRenderer.positionCount = segmentCount; -} - - void FixedUpdate() { UpdateLine(); @@ -63,9 +60,8 @@ public void Initialize(Vector3 start, Vector3 end) // Apply gravity to particles for (int i = 1; i < particles.Count; i++) { - particles[i].ApplyForce(Vector3.up * gravity * Time.deltaTime); - particles[i].UpdatePosition(Time.deltaTime); + particles[i].UpdatePosition(); } // Update sticks @@ -77,8 +73,42 @@ public void Initialize(Vector3 start, Vector3 end) } } } -} + public void UpdatePlug(Transform plug) + { + if (plug != null && particles.Count > 1) + { + Vector3 plugPosition = particles[particles.Count - 1].position; + float plugLength = plug.GetComponent().bounds.size.y; + Vector3 direction = particles[particles.Count - 1].position - particles[particles.Count - 2].position; + float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; + plug.position = plugPosition + direction.normalized * (plugLength / 2); + plug.rotation = Quaternion.Euler(0, 0, angle - 90f); + // Adjust the final particle position based on plug position + particles[particles.Count - 1].position = plugPosition + direction.normalized * (plugLength / 2); + } + } + public void UpdateEndPoint(Vector3 newEndPosition) + { + end = newEndPosition; + lineRenderer.positionCount = segmentCount; + + // Calculate current length and scale ratio + float currentLength = Vector3.Distance(start, newEndPosition); + float lengthRatio = currentLength / originalLength; + + // Apply length adjustment with smooth transition + for (int i = 1; i < particles.Count; i++) + { + Vector3 direction = (particles[i].position - start).normalized; + particles[i].position = start + direction * (Vector3.Distance(start, particles[i].position) * lengthRatio); + } + + // Lock the last particle and update its position + particles[particles.Count - 1].isLocked = true; + particles[particles.Count - 1].position = newEndPosition; + } +} \ No newline at end of file diff --git a/Assets/Scripts/FixSystem/Line/VerletParticle.cs b/Assets/Scripts/FixSystem/Line/VerletParticle.cs index 541fac213..636f86686 100644 --- a/Assets/Scripts/FixSystem/Line/VerletParticle.cs +++ b/Assets/Scripts/FixSystem/Line/VerletParticle.cs @@ -4,28 +4,40 @@ using UnityEngine; public class VerletParticle { - public Vector3 position; - public Vector3 previousPosition; - public bool isLocked; + public Vector3 position; // 当前帧位置 + public Vector3 previousPosition; // 上一帧位置 + public bool isLocked; // 是否锁定 public VerletParticle(Vector3 position) { this.position = position; - this.previousPosition = position; - this.isLocked = false; + this.previousPosition = position; // 初始时,上一帧的位置与当前相同 + this.isLocked = false; // 默认粒子不锁定 } + // Apply force to the particle (affects velocity) public void ApplyForce(Vector3 force) { - Vector3 temp = position; - position += position - previousPosition + force; - previousPosition = temp; + if (!isLocked) + { + Vector3 velocity = position - previousPosition; + Vector3 airResistance = -velocity * 0.15f; // 阻力系数 + velocity += (force + airResistance) * Time.deltaTime; + previousPosition = position; + position += velocity; + } } - public void UpdatePosition(float deltaTime) + + + // Update the particle's position using Verlet integration + public void UpdatePosition() { - Vector3 temp = position; - position += (position - previousPosition) * deltaTime; - previousPosition = temp; + if (!isLocked) + { + Vector3 velocity = position - previousPosition; // 计算当前速度 + previousPosition = position; // 更新上一帧位置 + position += velocity; // 用速度更新当前位置 + } } } diff --git a/Assets/Scripts/FixSystem/Line/VerletStick.cs b/Assets/Scripts/FixSystem/Line/VerletStick.cs index 22365793f..a894aaa3d 100644 --- a/Assets/Scripts/FixSystem/Line/VerletStick.cs +++ b/Assets/Scripts/FixSystem/Line/VerletStick.cs @@ -7,7 +7,7 @@ public class VerletStick private VerletParticle particleA; private VerletParticle particleB; private float length; - public float stiffness = 0.8f; // Add this line + public float stiffness = 0.3f; // Add this line public VerletStick(VerletParticle particleA, VerletParticle particleB, float length) { @@ -24,12 +24,12 @@ public class VerletStick if (!particleA.isLocked) { - particleA.position -= direction * difference * stiffness; // Change this line + particleA.position -= direction * difference * stiffness; } if (!particleB.isLocked) { - particleB.position += direction * difference * stiffness; // Change this line + particleB.position += direction * difference * stiffness; } } } diff --git a/Assets/Scripts/FixSystemNew/BodyModule/Cable.cs b/Assets/Scripts/FixSystemNew/BodyModule/Cable.cs index 81d1117ae..a2da3de9e 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/Cable.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/Cable.cs @@ -1,4 +1,5 @@ using System; +using DG.Tweening.Plugins.Core.PathCore; using UnityEngine; namespace AibisDream.FixSystem @@ -7,6 +8,8 @@ namespace AibisDream.FixSystem public class Cable : MonoBehaviour { private Transform _start; + + public Transform _controlPoint; private Transform _end; private LineRenderer _lineRenderer; @@ -65,6 +68,7 @@ namespace AibisDream.FixSystem float t = Mathf.InverseLerp(config.dstMin, config.dstMax, (_start.position - _end.position).magnitude); float F = Mathf.Lerp(config.forceMin, config.forceMax, t); _points[0] = _start.position; + _points[1] = _controlPoint.position; _points[^1] = _end.position; for (int ik = 0; ik < config.k; ik++) diff --git a/Assets/Scripts/FixSystemNew/BodyModule/CableSystem.cs b/Assets/Scripts/FixSystemNew/BodyModule/CableSystem.cs index 825fb0d1e..0c8e551d1 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/CableSystem.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/CableSystem.cs @@ -1,5 +1,6 @@ using UnityEngine; using UnityEngine.Events; +using UnityEngine.PlayerLoop; using Yarn.Unity; namespace AibisDream.FixSystem @@ -10,7 +11,11 @@ namespace AibisDream.FixSystem public Plug PlugRef { get; private set; } public Cable CableRef { get; private set; } + + public PhysicCable PhysicCableRef { get; private set; } public Transform CableRootPos { get; private set; } + + public Transform ControlPoint { get; private set; } public ISocket InitSocket { get; private set; } public BodyModuleSystem BodyModuleSystem { get; private set; } @@ -55,13 +60,19 @@ namespace AibisDream.FixSystem CableRef = transform.Find("Cable").GetComponent(); CableRootPos = transform.Find("Cable Root Pos").transform; InitSocket = transform.Find("Init Socket").GetComponent(); + PhysicCableRef = transform.Find("PhysicCable").GetComponent(); BodyModuleSystem = transform.parent.GetComponent(); } private void InitSystem() { - PlugRef.InitPlug(InitSocket); + //PlugRef.InitPlug(InitSocket); + PhysicCableRef.Init(); + } + public void Update() + { + } public void ResetPlug() diff --git a/Assets/Scripts/FixSystemNew/BodyModule/Plug.cs b/Assets/Scripts/FixSystemNew/BodyModule/Plug.cs index b4f7985a5..e2857cf58 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/Plug.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/Plug.cs @@ -1,6 +1,7 @@ using AibisDream.Framework; using AibisDream.Utility; using DG.Tweening; +using MeadowGames.UINodeConnect4.GraphicRenderer; using UnityEngine; using UnityEngine.EventSystems; @@ -52,7 +53,12 @@ namespace AibisDream.FixSystem public void InitPlug(ISocket initSocket) { - InsertSocket(initSocket); + //InsertSocket(initSocket); + } + public void InitPlug() + { + _cableSystem.PhysicCableRef.Init(); + //_cableSystem.PhysicCableRef.physicLine.UpdatePlug(this.transform); } /// @@ -143,12 +149,26 @@ namespace AibisDream.FixSystem else { // 没找到就插回初始Socket,需要播动画 - transform.DOMove(_cableSystem.InitSocket.GetSocketPos(), 0.1f).OnComplete(() => - { - InsertSocket(_cableSystem.InitSocket); - }); + // transform.DOMove(_cableSystem.InitSocket.GetSocketPos(), 0.1f).OnComplete(() => + // { + // InsertSocket(_cableSystem.InitSocket); + // }); } } + public void Update() + { + _cableSystem.PhysicCableRef.physicLine.UpdateEndPoint(this.transform.position); + // if(_cableSystem.curSocket!=null&&_isDragging==false) + // { + // _cableSystem.PhysicCableRef.physicLine.UpdatePlug(this.transform); + + // } + // else + // { + // _cableSystem.PhysicCableRef.physicLine.UpdateLine(this.transform); + // } + + } private void AdjustPlugPos() {