feat(Connect): 完成连线基本玩法,

This commit is contained in:
2025-10-19 19:38:52 +08:00
parent e14e8925de
commit f3d73ab65a
34 changed files with 2528 additions and 988 deletions

View File

@@ -16,29 +16,26 @@ namespace Gameplay.Player
public class PlayerWatchModeController : MonoBehaviour
{
[SerializeField] private Camera cam;
public event Action OnEnterInsideWatchMode;
public event Action OnExitInsideWatchMode;
public event Action<WatchMode> OnEnterWatchMode;
public event Action<WatchMode> OnExitWatchMode;
private InputManager inputManager;
private TimePauseManager timePauseManager;
private WatchMode currentMode = WatchMode.Normal;
private PlayerInteractorController playerInteractorController;
private PlayerConnectController _playerConnectController;
private WatchMode previousMode = WatchMode.Normal;
private WatchMode currentMode = WatchMode.Normal;
public WatchMode CurrentWatchMode
{
get => currentMode;
set
{
if (value != WatchMode.Inside)
{
OnExitInsideWatchMode?.Invoke();
}
if (value == WatchMode.Inside)
{
OnEnterInsideWatchMode?.Invoke();
}
previousMode = currentMode;
currentMode = value;
// 触发退出事件
OnExitWatchMode?.Invoke(previousMode);
OnEnterWatchMode?.Invoke(currentMode);
SwitchWatchMode(currentMode);
}
}
@@ -48,6 +45,7 @@ namespace Gameplay.Player
inputManager = InputManager.Instance;
timePauseManager = TimePauseManager.Instance;
playerInteractorController = GetComponent<PlayerInteractorController>();
_playerConnectController = GetComponent<PlayerConnectController>();
var input = inputManager.Input;
input.Player.SwitchWatchMode.performed += ctx =>
@@ -80,6 +78,11 @@ namespace Gameplay.Player
playerInteractorController.SetPlayerInteractionEnabled(true);
}
if (_playerConnectController != null)
{
_playerConnectController.IsEnableConnecting = false;
}
break;
case WatchMode.Inside:
SetSeeLines(false);
@@ -95,6 +98,11 @@ namespace Gameplay.Player
{
playerInteractorController.SetPlayerInteractionEnabled(false);
}
if (_playerConnectController != null)
{
_playerConnectController.IsEnableConnecting = false;
}
break;
case WatchMode.Outside:
@@ -111,6 +119,11 @@ namespace Gameplay.Player
{
playerInteractorController.SetPlayerInteractionEnabled(true);
}
if (_playerConnectController != null)
{
_playerConnectController.IsEnableConnecting = true;
}
break;
default: