Beispiel #1
0
 public InRangeCellInfo(GameObject gameObject, GameObject objectsContainerGameObject, ICellRecord cellRecord, IEnumerator objectsCreationCoroutine)
 {
     GameObject = gameObject;
     ObjectsContainerGameObject = objectsContainerGameObject;
     CellRecord = cellRecord;
     ObjectsCreationCoroutine = objectsCreationCoroutine;
 }
Beispiel #2
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);
        }
Beispiel #3
0
 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;
 }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
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);
            }
        }