feat(Connect): 完成连线基本玩法,
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user