private void OnDisable() { _treasureManager = null; _roundTimer = null; _mortarManager = null; _krakenManager = null; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; }
void Awake() { GraphicsSettings.useScriptableRenderPipelineBatching = true; #if !UNITY_EDITOR Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; #endif _levelEventManager = gameObject.AddComponent <LevelEventManager>(); _audioSourcePoolManager = gameObject.AddComponent <AudioSourcePoolManager>(); // Spawn players _entityManager = new EntityManager(playerPrefab); for (int i = 1; i <= _numberOfPlayers; i++) // Player index starts from 1 { _entityManager.CreatePlayer(i); } // Setup camera _cameraHandler = FindObjectOfType <CameraHandler>(); _treasureManager = new TreasureManager(); _roundTimer = new RoundTimer(); _navMeshManager = gameObject.AddComponent <NavMeshManager>(); _shipManager = gameObject.AddComponent <ShipManager>(); _hazardManager = GetComponent <HazardManager>(); _mortarManager = new MortarManager(); _krakenManager = new KrakenManager(); _cameraHandler.Init(_entityManager.GetAllPlayers()); _treasureManager.Init(goldCounterUI); _roundTimer.Init(roundTimeUI); _navMeshManager.Init(_shipManager.GetShip(ShipType.Player)); _shipManager.Init(); _hazardManager.Init(roundTimeUI, _shipManager.GetShip(ShipType.Player)); _mortarManager.Init(); _krakenManager.Init(); }