Compare commits

...

2 Commits

21 changed files with 80 additions and 30 deletions

View File

@@ -328,9 +328,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5981311fef324f939be05186f7936173, type: 3} m_Script: {fileID: 11500000, guid: 5981311fef324f939be05186f7936173, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
IsEnableConnecting: 1
raycaster: {fileID: 8217262775185484522} raycaster: {fileID: 8217262775185484522}
linePrefab: {fileID: 2140853775088731430, guid: 5ded9ec889d81364ba1dd360c848f147,
type: 3}
--- !u!1 &3610935294554348573 --- !u!1 &3610935294554348573
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -50,6 +50,11 @@ namespace Script.Gameplay.Connect
_input.ReceiveSignal(active,this.gameObject); _input.ReceiveSignal(active,this.gameObject);
} }
public void DeleteConnection()
{
Destroy(this.gameObject);
}
private void OnDestroy() private void OnDestroy()
{ {
if (_output != null) if (_output != null)

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Gameplay.Player; using Script.Gameplay.Player;
using UnityEngine; using UnityEngine;
using Script.Gameplay.Interface; using Script.Gameplay.Interface;
using Script.Gameplay.Connect; using Script.Gameplay.Connect;

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Gameplay.Player; using Script.Gameplay.Player;
using UnityEngine; using UnityEngine;
using Script.Gameplay.Interface; using Script.Gameplay.Interface;

View File

@@ -118,6 +118,15 @@ namespace Script.Gameplay.Input
""processors"": """", ""processors"": """",
""interactions"": """", ""interactions"": """",
""initialStateCheck"": false ""initialStateCheck"": false
},
{
""name"": ""CutLine"",
""type"": ""Button"",
""id"": ""bf20e378-b5e0-4749-90b7-fc2aa09bd5c9"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
} }
], ],
""bindings"": [ ""bindings"": [
@@ -274,6 +283,17 @@ namespace Script.Gameplay.Input
""action"": ""SetInput"", ""action"": ""SetInput"",
""isComposite"": false, ""isComposite"": false,
""isPartOfComposite"": false ""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""53d79cef-a048-4b85-8078-03fcfeb79182"",
""path"": ""<Keyboard>/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_Connect = m_Player.FindAction("Connect", throwIfNotFound: true);
m_Player_SetOutput = m_Player.FindAction("SetOutput", throwIfNotFound: true); m_Player_SetOutput = m_Player.FindAction("SetOutput", throwIfNotFound: true);
m_Player_SetInput = m_Player.FindAction("SetInput", throwIfNotFound: true); m_Player_SetInput = m_Player.FindAction("SetInput", throwIfNotFound: true);
m_Player_CutLine = m_Player.FindAction("CutLine", throwIfNotFound: true);
} }
~@PlayerInputActions() ~@PlayerInputActions()
@@ -368,6 +389,7 @@ namespace Script.Gameplay.Input
private readonly InputAction m_Player_Connect; private readonly InputAction m_Player_Connect;
private readonly InputAction m_Player_SetOutput; private readonly InputAction m_Player_SetOutput;
private readonly InputAction m_Player_SetInput; private readonly InputAction m_Player_SetInput;
private readonly InputAction m_Player_CutLine;
public struct PlayerActions public struct PlayerActions
{ {
private @PlayerInputActions m_Wrapper; private @PlayerInputActions m_Wrapper;
@@ -382,6 +404,7 @@ namespace Script.Gameplay.Input
public InputAction @Connect => m_Wrapper.m_Player_Connect; public InputAction @Connect => m_Wrapper.m_Player_Connect;
public InputAction @SetOutput => m_Wrapper.m_Player_SetOutput; public InputAction @SetOutput => m_Wrapper.m_Player_SetOutput;
public InputAction @SetInput => m_Wrapper.m_Player_SetInput; 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 InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); } public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); } public void Disable() { Get().Disable(); }
@@ -421,6 +444,9 @@ namespace Script.Gameplay.Input
@SetInput.started += instance.OnSetInput; @SetInput.started += instance.OnSetInput;
@SetInput.performed += instance.OnSetInput; @SetInput.performed += instance.OnSetInput;
@SetInput.canceled += instance.OnSetInput; @SetInput.canceled += instance.OnSetInput;
@CutLine.started += instance.OnCutLine;
@CutLine.performed += instance.OnCutLine;
@CutLine.canceled += instance.OnCutLine;
} }
private void UnregisterCallbacks(IPlayerActions instance) private void UnregisterCallbacks(IPlayerActions instance)
@@ -455,6 +481,9 @@ namespace Script.Gameplay.Input
@SetInput.started -= instance.OnSetInput; @SetInput.started -= instance.OnSetInput;
@SetInput.performed -= instance.OnSetInput; @SetInput.performed -= instance.OnSetInput;
@SetInput.canceled -= instance.OnSetInput; @SetInput.canceled -= instance.OnSetInput;
@CutLine.started -= instance.OnCutLine;
@CutLine.performed -= instance.OnCutLine;
@CutLine.canceled -= instance.OnCutLine;
} }
public void RemoveCallbacks(IPlayerActions instance) public void RemoveCallbacks(IPlayerActions instance)
@@ -484,6 +513,7 @@ namespace Script.Gameplay.Input
void OnConnect(InputAction.CallbackContext context); void OnConnect(InputAction.CallbackContext context);
void OnSetOutput(InputAction.CallbackContext context); void OnSetOutput(InputAction.CallbackContext context);
void OnSetInput(InputAction.CallbackContext context); void OnSetInput(InputAction.CallbackContext context);
void OnCutLine(InputAction.CallbackContext context);
} }
} }
} }

View File

@@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
using Gameplay.Player; using Script.Gameplay.Player;
using System.Collections.Generic; using System.Collections.Generic;
using Script.Gameplay.Facility; using Script.Gameplay.Facility;

View File

@@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
/// <summary> /// <summary>
/// 通用第一人称射线检测,获取玩家注视的 GameObject。 /// 通用第一人称射线检测,获取玩家注视的 GameObject。

View File

@@ -2,7 +2,7 @@ using Core;
using UnityEngine; using UnityEngine;
using Script.Gameplay.Input; using Script.Gameplay.Input;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
/// <summary> /// <summary>
/// 玩家第一人称相机控制器 /// 玩家第一人称相机控制器

View File

@@ -5,7 +5,7 @@ using Script.Gameplay.Connect;
using Script.Gameplay.Input; using Script.Gameplay.Input;
using System; using System;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
public class PlayerConnectController : MonoBehaviour public class PlayerConnectController : MonoBehaviour
{ {
@@ -27,6 +27,7 @@ namespace Gameplay.Player
inputManager.Input.Player.SetOutput.performed += ctx => SetOutTarget(currentTarget); inputManager.Input.Player.SetOutput.performed += ctx => SetOutTarget(currentTarget);
inputManager.Input.Player.SetInput.performed += ctx => SetInputTarget(currentTarget); inputManager.Input.Player.SetInput.performed += ctx => SetInputTarget(currentTarget);
inputManager.Input.Player.Connect.performed += ctx => CreateConnection(); inputManager.Input.Player.Connect.performed += ctx => CreateConnection();
inputManager.Input.Player.CutLine.performed += ctx => CutConnectLine(currentTarget);
if (raycaster == null) if (raycaster == null)
raycaster = GetComponent<FirstPersonRaycaster>() ?? GetComponentInChildren<FirstPersonRaycaster>(); raycaster = GetComponent<FirstPersonRaycaster>() ?? GetComponentInChildren<FirstPersonRaycaster>();
@@ -97,6 +98,14 @@ namespace 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() private void CreateConnection()
{ {
if(!IsEnableConnecting) return; if(!IsEnableConnecting) return;

View File

@@ -1,9 +0,0 @@
using UnityEngine;
namespace Gameplay.Player
{
public class PlayerConnectionLineController : MonoBehaviour
{
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e152f6521db343f3aac46c7c448491bc
timeCreated: 1760841639

View File

@@ -1,13 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Gameplay;
using Script.Gameplay.Interface; using Script.Gameplay.Interface;
using UnityEngine; using UnityEngine;
using Core; using Core;
using Script.Gameplay.Global; using Script.Gameplay.Global;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
public class PlayerController : MonoBehaviour, IDamageable public class PlayerController : MonoBehaviour, IDamageable
{ {

View File

@@ -3,7 +3,7 @@ using UnityEngine;
using Script.Gameplay.Interface; using Script.Gameplay.Interface;
using Script.Gameplay.Input; using Script.Gameplay.Input;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
public class PlayerEditController:MonoBehaviour public class PlayerEditController:MonoBehaviour
{ {

View File

@@ -3,7 +3,7 @@ using Script.Gameplay.Interface;
using System; using System;
using Script.Gameplay.Input; using Script.Gameplay.Input;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
public class PlayerInteractorController : MonoBehaviour public class PlayerInteractorController : MonoBehaviour
{ {

View File

@@ -3,7 +3,7 @@ using Core;
using Script.Gameplay.Input; using Script.Gameplay.Input;
using UnityEngine; using UnityEngine;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
public class PlayerMoveController : MonoBehaviour public class PlayerMoveController : MonoBehaviour
{ {

View File

@@ -4,7 +4,7 @@ using UnityEngine;
using Core; using Core;
using Script.Gameplay.Global; using Script.Gameplay.Global;
namespace Gameplay.Player namespace Script.Gameplay.Player
{ {
public enum WatchMode public enum WatchMode
{ {

View File

@@ -1,6 +1,6 @@
using System; using System;
using Core; using Core;
using Gameplay.Player; using Script.Gameplay.Player;
using Script.Gameplay.Connect; using Script.Gameplay.Connect;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Core; using Core;
using Script.Gameplay.Interface; using Script.Gameplay.Interface;
using Gameplay.Player; using Script.Gameplay.Player;
using Script.Gameplay.Facility; using Script.Gameplay.Facility;
using UnityEngine; using UnityEngine;
using Script.Gameplay.Input; using Script.Gameplay.Input;

View File

@@ -1,6 +1,6 @@
using System; using System;
using Core; using Core;
using Gameplay.Player; using Script.Gameplay.Player;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;

View File

@@ -1,6 +1,6 @@
using System; using System;
using Core; using Core;
using Gameplay.Player; using Script.Gameplay.Player;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;

View File

@@ -94,6 +94,15 @@
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false
},
{
"name": "CutLine",
"type": "Button",
"id": "bf20e378-b5e0-4749-90b7-fc2aa09bd5c9",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
} }
], ],
"bindings": [ "bindings": [
@@ -250,6 +259,17 @@
"action": "SetInput", "action": "SetInput",
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
},
{
"name": "",
"id": "53d79cef-a048-4b85-8078-03fcfeb79182",
"path": "<Keyboard>/x",
"interactions": "",
"processors": "",
"groups": "",
"action": "CutLine",
"isComposite": false,
"isPartOfComposite": false
} }
] ]
} }