public void BeforeTest() { _previousCursorLockMode = Cursor.lockState; _gameModeComponent = new GameObject().AddComponent <TestGameModeComponent>(); _gameModeComponent.gameObject.AddComponent <TestUnityMessageEventDispatcherComponent>().TestAwake(); _controllerComponent = _gameModeComponent.gameObject.AddComponent <TestControllerComponent>(); _gameModeComponent.PlayerControllerType = _controllerComponent.gameObject; _gameModeComponent.PlayerCharacterType = new GameObject { name = "TestName" }; _gameModeComponent.HUDType = new GameObject(); var serviceProvider = new GameObject().AddComponent <TestGameServiceProvider>(); serviceProvider.TestAwake(); _spawnService = new MockSpawnService(); serviceProvider.AddService <ISpawnServiceInterface>(_spawnService); _spawnService.GetNearestSpawnLocationResult = _gameModeComponent.gameObject.transform; _spawnLocation = new GameObject().AddComponent <TestSpawnLocationComponent>(); _gameModeComponent.StartingSpawnLocation = _spawnLocation; }
public void AfterTest() { _spawnService = null; GameServiceProvider.ClearGameServiceProvider(); GameModeComponent.RegisteredGameMode = null; Cursor.visible = true; Cursor.lockState = _previousCursorLockMode; }