Example #1
0
        private static void SpawnPlayer(GameObject playerPrefab, Vector3Int gridId, Vector3 position)
        {
            _currentCell = Data.FindCellRecord(gridId);
            Utils.Assert(_currentCell != null);
            CreatePlayer(playerPrefab, position, out _playerCameraObj);
            var cellInfo = CellManager.StartCreatingCell(gridId);

            LoadBalancer.WaitForTask(cellInfo.ObjectsCreationCoroutine);
        }
Example #2
0
        /// <summary>
        /// Spawns the player inside using the cell's grid coordinates.
        /// </summary>
        /// <param name="playerPrefab">The player prefab.</param>
        /// <param name="position">The target position of the player.</param>
        public void SpawnPlayer(GameObject playerPrefab, Vector3 position)
        {
            var cellId = CellManager.GetCellId(position, _currentWorld);

            _currentCell = Data.FindCellRecord(cellId);
            Debug.Assert(_currentCell != null);
            CreatePlayer(playerPrefab, position, out _playerCameraObj);
            var cellInfo = CellManager.StartCreatingCell(cellId);

            LoadBalancer.WaitForTask(cellInfo.ObjectsCreationCoroutine);
            if (cellId.z != -1)
            {
                OnExteriorCell(_currentCell);
            }
            else
            {
                OnInteriorCell(_currentCell);
            }
        }