diff --git a/Assets/Prefab/Gameplay/Player.prefab b/Assets/Prefab/Gameplay/Player.prefab index 8f39230..fbf96cb 100644 --- a/Assets/Prefab/Gameplay/Player.prefab +++ b/Assets/Prefab/Gameplay/Player.prefab @@ -328,9 +328,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5981311fef324f939be05186f7936173, type: 3} m_Name: m_EditorClassIdentifier: + IsEnableConnecting: 1 raycaster: {fileID: 8217262775185484522} - linePrefab: {fileID: 2140853775088731430, guid: 5ded9ec889d81364ba1dd360c848f147, - type: 3} --- !u!1 &3610935294554348573 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Script/Gameplay/Connect/ConnectionLine.cs b/Assets/Script/Gameplay/Connect/ConnectionLine.cs index eb22f02..1b1531b 100644 --- a/Assets/Script/Gameplay/Connect/ConnectionLine.cs +++ b/Assets/Script/Gameplay/Connect/ConnectionLine.cs @@ -49,6 +49,11 @@ namespace Script.Gameplay.Connect { _input.ReceiveSignal(active,this.gameObject); } + + public void DeleteConnection() + { + Destroy(this.gameObject); + } private void OnDestroy() { diff --git a/Assets/Script/Gameplay/Input/PlayerInputActions.cs b/Assets/Script/Gameplay/Input/PlayerInputActions.cs index e687d27..123fb8a 100644 --- a/Assets/Script/Gameplay/Input/PlayerInputActions.cs +++ b/Assets/Script/Gameplay/Input/PlayerInputActions.cs @@ -118,6 +118,15 @@ namespace Script.Gameplay.Input ""processors"": """", ""interactions"": """", ""initialStateCheck"": false + }, + { + ""name"": ""CutLine"", + ""type"": ""Button"", + ""id"": ""bf20e378-b5e0-4749-90b7-fc2aa09bd5c9"", + ""expectedControlType"": """", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false } ], ""bindings"": [ @@ -274,6 +283,17 @@ namespace Script.Gameplay.Input ""action"": ""SetInput"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""53d79cef-a048-4b85-8078-03fcfeb79182"", + ""path"": ""/x"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""CutLine"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] } @@ -292,6 +312,7 @@ namespace Script.Gameplay.Input m_Player_Connect = m_Player.FindAction("Connect", throwIfNotFound: true); m_Player_SetOutput = m_Player.FindAction("SetOutput", throwIfNotFound: true); m_Player_SetInput = m_Player.FindAction("SetInput", throwIfNotFound: true); + m_Player_CutLine = m_Player.FindAction("CutLine", throwIfNotFound: true); } ~@PlayerInputActions() @@ -368,6 +389,7 @@ namespace Script.Gameplay.Input private readonly InputAction m_Player_Connect; private readonly InputAction m_Player_SetOutput; private readonly InputAction m_Player_SetInput; + private readonly InputAction m_Player_CutLine; public struct PlayerActions { private @PlayerInputActions m_Wrapper; @@ -382,6 +404,7 @@ namespace Script.Gameplay.Input public InputAction @Connect => m_Wrapper.m_Player_Connect; public InputAction @SetOutput => m_Wrapper.m_Player_SetOutput; public InputAction @SetInput => m_Wrapper.m_Player_SetInput; + public InputAction @CutLine => m_Wrapper.m_Player_CutLine; public InputActionMap Get() { return m_Wrapper.m_Player; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -421,6 +444,9 @@ namespace Script.Gameplay.Input @SetInput.started += instance.OnSetInput; @SetInput.performed += instance.OnSetInput; @SetInput.canceled += instance.OnSetInput; + @CutLine.started += instance.OnCutLine; + @CutLine.performed += instance.OnCutLine; + @CutLine.canceled += instance.OnCutLine; } private void UnregisterCallbacks(IPlayerActions instance) @@ -455,6 +481,9 @@ namespace Script.Gameplay.Input @SetInput.started -= instance.OnSetInput; @SetInput.performed -= instance.OnSetInput; @SetInput.canceled -= instance.OnSetInput; + @CutLine.started -= instance.OnCutLine; + @CutLine.performed -= instance.OnCutLine; + @CutLine.canceled -= instance.OnCutLine; } public void RemoveCallbacks(IPlayerActions instance) @@ -484,6 +513,7 @@ namespace Script.Gameplay.Input void OnConnect(InputAction.CallbackContext context); void OnSetOutput(InputAction.CallbackContext context); void OnSetInput(InputAction.CallbackContext context); + void OnCutLine(InputAction.CallbackContext context); } } } diff --git a/Assets/Script/Gameplay/Player/PlayerConnectController.cs b/Assets/Script/Gameplay/Player/PlayerConnectController.cs index 27ac5c6..250ca88 100644 --- a/Assets/Script/Gameplay/Player/PlayerConnectController.cs +++ b/Assets/Script/Gameplay/Player/PlayerConnectController.cs @@ -27,6 +27,7 @@ namespace Script.Gameplay.Player inputManager.Input.Player.SetOutput.performed += ctx => SetOutTarget(currentTarget); inputManager.Input.Player.SetInput.performed += ctx => SetInputTarget(currentTarget); inputManager.Input.Player.Connect.performed += ctx => CreateConnection(); + inputManager.Input.Player.CutLine.performed += ctx => CutConnectLine(currentTarget); if (raycaster == null) raycaster = GetComponent() ?? GetComponentInChildren(); @@ -97,6 +98,14 @@ namespace Script.Gameplay.Player } } + public void CutConnectLine(IConnectable target) + { + if (target == null) return; + if(target.OutputConnectionLine != null && target.InputConnectionLine != null) return; + target.OutputConnectionLine?.DeleteConnection(); + target.InputConnectionLine?.DeleteConnection(); + } + private void CreateConnection() { if(!IsEnableConnecting) return; diff --git a/Assets/Script/Gameplay/Player/PlayerConnectionLineController.cs b/Assets/Script/Gameplay/Player/PlayerConnectionLineController.cs deleted file mode 100644 index ac2a150..0000000 --- a/Assets/Script/Gameplay/Player/PlayerConnectionLineController.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine; - -namespace Script.Gameplay.Player -{ - public class PlayerConnectionLineController : MonoBehaviour - { - - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Player/PlayerConnectionLineController.cs.meta b/Assets/Script/Gameplay/Player/PlayerConnectionLineController.cs.meta deleted file mode 100644 index d320aeb..0000000 --- a/Assets/Script/Gameplay/Player/PlayerConnectionLineController.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e152f6521db343f3aac46c7c448491bc -timeCreated: 1760841639 \ No newline at end of file diff --git a/Assets/Settings/Input/PlayerInputActions.inputactions b/Assets/Settings/Input/PlayerInputActions.inputactions index 01a9f59..27882d6 100644 --- a/Assets/Settings/Input/PlayerInputActions.inputactions +++ b/Assets/Settings/Input/PlayerInputActions.inputactions @@ -94,6 +94,15 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "CutLine", + "type": "Button", + "id": "bf20e378-b5e0-4749-90b7-fc2aa09bd5c9", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -250,6 +259,17 @@ "action": "SetInput", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "53d79cef-a048-4b85-8078-03fcfeb79182", + "path": "/x", + "interactions": "", + "processors": "", + "groups": "", + "action": "CutLine", + "isComposite": false, + "isPartOfComposite": false } ] }