fix(): 修复重启后切换模式后相机丢失BUG,修复重启后UI绑定失效的BUG,将GameManager移动到Gameplay

This commit is contained in:
2025-10-26 09:56:23 +08:00
parent 95616f8c10
commit 9094b17a3d
7 changed files with 55 additions and 367 deletions

View File

@@ -554,74 +554,6 @@ PrefabInstance:
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 852526192} addedObject: {fileID: 852526192}
m_SourcePrefab: {fileID: 100100000, guid: 8f4de64a5cce27745b5566ff3ef971c8, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 8f4de64a5cce27745b5566ff3ef971c8, type: 3}
--- !u!1001 &31717449
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.51336026
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.37061486
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalPosition.z
value: 1.5721664
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1586746027131230676, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5223255733355640781, guid: 2a2113dbf189fbd44bca90f4df91f338,
type: 3}
propertyPath: m_Name
value: InputManager
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2a2113dbf189fbd44bca90f4df91f338, type: 3}
--- !u!1001 &43889001 --- !u!1001 &43889001
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -6644,74 +6576,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 2009785149} m_Father: {fileID: 2009785149}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &769057572
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3918776012077598679, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_Name
value: GameCountDownManager
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalPosition.x
value: 829.4015
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalPosition.y
value: 383.09033
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalPosition.z
value: 3.2512481
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4952453861214115371, guid: 9e2e93bf07726014bac5a458c32e697f,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9e2e93bf07726014bac5a458c32e697f, type: 3}
--- !u!1001 &770547568 --- !u!1001 &770547568
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -11328,74 +11192,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 705072614} m_Father: {fileID: 705072614}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1279118200
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2130934091406547798, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_Name
value: GameFlowManager
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalPosition.x
value: 829.4015
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalPosition.y
value: 383.09033
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalPosition.z
value: 3.2512481
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8520498794796434433, guid: f480e7d630901ad48a69a5df6d2132f2,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f480e7d630901ad48a69a5df6d2132f2, type: 3}
--- !u!1 &1280149366 --- !u!1 &1280149366
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -12246,17 +12042,17 @@ PrefabInstance:
- target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b, - target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -6.311 value: -6.9859
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b, - target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b,
type: 3} type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 3.575 value: 2.101
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b, - target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b,
type: 3} type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: -3.106 value: -0.5246
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b, - target: {fileID: 7437893023972897012, guid: 667aedb0d3f8c9d469819c9ff2b4472b,
type: 3} type: 3}
@@ -13312,74 +13108,6 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8f4de64a5cce27745b5566ff3ef971c8, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 8f4de64a5cce27745b5566ff3ef971c8, type: 3}
--- !u!1001 &1532480746
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5532734616494925005, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_Name
value: TimePauseManager
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.29564962
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalPosition.y
value: 4.269477
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalPosition.z
value: -1.7842796
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 781c629235eee4f4eb34f1e763aa7f67, type: 3}
--- !u!114 &1543743027 stripped --- !u!114 &1543743027 stripped
MonoBehaviour: MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4936355834716623489, guid: be07db3098b709a40a6965f50f8c9640, m_CorrespondingSourceObject: {fileID: 4936355834716623489, guid: be07db3098b709a40a6965f50f8c9640,
@@ -19167,74 +18895,6 @@ Transform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 2126243156} m_PrefabInstance: {fileID: 2126243156}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &2706680471642920534
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalPosition.x
value: 1341.3049
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalPosition.y
value: 771.7224
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.19054106
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1741528481904243288, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5733440185495106210, guid: 580e72e098ea0074795102df8d1f812e,
type: 3}
propertyPath: m_Name
value: EditableManager
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 580e72e098ea0074795102df8d1f812e, type: 3}
--- !u!1001 &7233731901126413131 --- !u!1001 &7233731901126413131
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -19562,12 +19222,7 @@ PrefabInstance:
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_Roots: m_Roots:
- {fileID: 31717449}
- {fileID: 1532480746}
- {fileID: 1279118200}
- {fileID: 769057572}
- {fileID: 7233731901126413131} - {fileID: 7233731901126413131}
- {fileID: 2706680471642920534}
- {fileID: 2021089518} - {fileID: 2021089518}
- {fileID: 539242447} - {fileID: 539242447}
- {fileID: 522947464} - {fileID: 522947464}

View File

@@ -41,11 +41,17 @@ namespace Core
public void LoadGameplay(string sceneName) public void LoadGameplay(string sceneName)
{ {
StartCoroutine(SwitchGameplay(sceneName)); StartCoroutine(SwitchGameplay(sceneName));
if (!isLoadGameplayUI) ReLoadUIScene();
}
public void ReLoadUIScene()
{
if (isLoadGameplayUI)
{ {
StartCoroutine(LoadSceneAdditive("UIScene")); StartCoroutine(UnloadScene("UIScene"));
isLoadGameplayUI = true;
} }
StartCoroutine(LoadSceneAdditive("UIScene"));
isLoadGameplayUI = true;
} }
private IEnumerator SwitchGameplay(string newScene) private IEnumerator SwitchGameplay(string newScene)

View File

@@ -23,7 +23,7 @@ namespace Script.Gameplay.Global
private void Start() private void Start()
{ {
_gameCountdownManager = GameCountdownManager.Instance; _gameCountdownManager = GameCountdownManager.Instance;
_gameCountdownManager.StartLevelTimer(); GameManager.Instance.OnGameStart += OnGameStart;
_gameCountdownManager.OnFinish.AddListener(() => _gameCountdownManager.OnFinish.AddListener(() =>
{ {
if (IsOpenRestartGameOnCountdownFinish) if (IsOpenRestartGameOnCountdownFinish)
@@ -32,11 +32,16 @@ namespace Script.Gameplay.Global
); );
} }
public void OnGameStart()
{
_gameCountdownManager.StartLevelTimer();
}
public IEnumerator OnCountDown() public IEnumerator OnCountDown()
{ {
StartCoroutine(ScreenGlitchManager.Instance.TriggerGlitchEffect()); StartCoroutine(ScreenGlitchManager.Instance.TriggerGlitchEffect());
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f);
GameManager.Instance.ReStartGameplay(); GameManager.Instance.StartGameplay();
} }
} }
} }

View File

@@ -1,7 +1,7 @@
using System; using System;
using Core;
namespace Core namespace Script.Gameplay.Global
{ {
public class GameManager : MonoSingleton<GameManager> public class GameManager : MonoSingleton<GameManager>
{ {
@@ -11,10 +11,16 @@ namespace Core
ScenesManager.Instance.LoadMainMenu(); ScenesManager.Instance.LoadMainMenu();
} }
public void ReStartGameplay() public void StartGameplay()
{ {
ScenesManager.Instance.LoadGameplay("Level1"); ScenesManager.Instance.LoadGameplay("Level1");
OnGameStart?.Invoke(); OnGameStart?.Invoke();
} }
public void StartTest()
{
ScenesManager.Instance.LoadGameplay("Test");
OnGameStart?.Invoke();
}
} }
} }

View File

@@ -3,6 +3,7 @@ using Script.Gameplay.Input;
using UnityEngine; using UnityEngine;
using Core; using Core;
using Script.Gameplay.Global; using Script.Gameplay.Global;
using UnityEngine.InputSystem;
namespace Script.Gameplay.Player namespace Script.Gameplay.Player
{ {
@@ -34,7 +35,7 @@ namespace Script.Gameplay.Player
// 触发退出事件 // 触发退出事件
OnExitWatchMode?.Invoke(previousMode); OnExitWatchMode?.Invoke(previousMode);
OnEnterWatchMode?.Invoke(currentMode); OnEnterWatchMode?.Invoke(currentMode);
SwitchWatchMode(currentMode); SwitchWatchMode(currentMode);
} }
} }
@@ -47,17 +48,19 @@ namespace Script.Gameplay.Player
playerConnectController = GetComponent<PlayerConnectController>(); playerConnectController = GetComponent<PlayerConnectController>();
var input = inputManager.Input; var input = inputManager.Input;
input.Player.SwitchWatchMode.performed += ctx => input.Player.SwitchWatchMode.performed += RegisterInput
{ ;
var modeTemp = (WatchMode)(((int)CurrentWatchMode + 1) % Enum.GetNames(typeof(WatchMode)).Length);
CurrentWatchMode = modeTemp;
};
;
ControllerLocator.Instance.Register(this); ControllerLocator.Instance.Register(this);
OnEnterWatchMode?.Invoke(currentMode); OnEnterWatchMode?.Invoke(currentMode);
} }
private void RegisterInput(InputAction.CallbackContext ctx)
{
var modeTemp = (WatchMode)(((int)CurrentWatchMode + 1) % Enum.GetNames(typeof(WatchMode)).Length);
CurrentWatchMode = modeTemp;
}
// 实现按Tap键实现在WatchMode 3个模式切换并通过SwitchWatchMode设置正确的相机模式 // 实现按Tap键实现在WatchMode 3个模式切换并通过SwitchWatchMode设置正确的相机模式
private void SwitchWatchMode(WatchMode watchMode) private void SwitchWatchMode(WatchMode watchMode)
{ {
@@ -78,6 +81,7 @@ namespace Script.Gameplay.Player
{ {
playerConnectController.IsEnablePlayerConnecting = false; playerConnectController.IsEnablePlayerConnecting = false;
} }
break; break;
case WatchMode.Outside: case WatchMode.Outside:
SetSeeLines(true); SetSeeLines(true);
@@ -89,7 +93,7 @@ namespace Script.Gameplay.Player
{ {
playerInteractorController.SetPlayerInteractionEnabled(true); playerInteractorController.SetPlayerInteractionEnabled(true);
} }
if (playerConnectController != null) if (playerConnectController != null)
{ {
playerConnectController.IsEnablePlayerConnecting = true; playerConnectController.IsEnablePlayerConnecting = true;
@@ -113,5 +117,13 @@ namespace Script.Gameplay.Player
cam.cullingMask = mask; cam.cullingMask = mask;
} }
private void OnDestroy()
{
ControllerLocator.Instance.Unregister<PlayerWatchModeController>(this);
var input = inputManager.Input;
input.Player.SwitchWatchMode.performed -= RegisterInput;
}
} }
} }

View File

@@ -1,16 +1,20 @@
using UnityEngine; using UnityEngine;
using Core; using Core;
using Script.Gameplay.Input; using Script.Gameplay.Input;
using Script.Gameplay.Global;
namespace UI namespace UI
{ {
public class StartGameButton : UIBase public class StartGameButton : UIBase
{ {
public string levelName = "Level1"; public string levelName = "Level1";
public void StartGame() public void StartGame()
{ {
ScenesManager.Instance.LoadGameplay(levelName); if (levelName == "Level1")
InputManager.Instance.SetCursorState(false,CursorLockMode.Locked); GameManager.Instance.StartGameplay();
else if (levelName == "Test")
GameManager.Instance.StartTest();
InputManager.Instance.SetCursorState(false, CursorLockMode.Locked);
} }
} }
} }