public InRangeCellInfo(GameObject gameObject, GameObject objectsContainerGameObject, ICellRecord cellRecord, IEnumerator objectsCreationCoroutine) { GameObject = gameObject; ObjectsContainerGameObject = objectsContainerGameObject; CellRecord = cellRecord; ObjectsCreationCoroutine = objectsCreationCoroutine; }
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); }
protected virtual void OnExteriorCell(ICellRecord CELL) { RenderSettings.ambientLight = _defaultAmbientColor; _sunObj.SetActive(true); //_waterObj.transform.position = Vector3.zero; //_waterObj.SetActive(true); //_underwaterEffect.enabled = true; //_underwaterEffect.Level = 0.0f; }
/// <summary> /// Spawns the player outside using the position of the player. /// </summary> /// <param name="playerPrefab">The player prefab.</param> /// <param name="position">The target position of the player.</param> public void SpawnPlayerAndUpdate(GameObject playerPrefab, Vector3 position) { var cellId = CellManager.GetCellId(position, _currentWorld); _currentCell = Data.FindCellRecord(cellId); CreatePlayer(playerPrefab, position, out _playerCameraObj); CellManager.UpdateCells(_playerCameraObj.transform.position, _currentWorld, true, CellRadiusOnLoad); OnExteriorCell(_currentCell); }
protected virtual void OnInteriorCell(ICellRecord CELL) { var cellAmbientLight = CELL.AmbientLight; if (cellAmbientLight != null) { RenderSettings.ambientLight = cellAmbientLight.Value; } _sunObj.SetActive(false); //_underwaterEffect.enabled = CELL.WHGT != null; //if (CELL.WHGT != null) //{ // var offset = 1.6f; // Interiors cells needs this offset to render at the correct location. // _waterObj.transform.position = new Vector3(0, (CELL.WHGT.value / Convert.meterInMWUnits) - offset, 0); // _waterObj.SetActive(true); // _underwaterEffect.Level = _waterObj.transform.position.y; //} //else _waterObj.SetActive(false); }
/// <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); } }