コード例 #1
0
ファイル: BaseEngine.cs プロジェクト: BclEx/object-assets
        /// <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);
        }
コード例 #2
0
 public virtual void Update()
 {
     if (_playerCameraObj == null)
     {
         return;
     }
     // The current cell can be null if the player is outside of the defined game world.
     if (_currentCell == null || !_currentCell.IsInterior)
     {
         CellManager.UpdateCells(_playerCameraObj.transform.position, _currentWorld);
     }
     LoadBalancer.RunTasks(DesiredWorkTimePerFrame);
 }