Beispiel #1
0
        // ---------------------------------------------------------------------------------------------
        private void resetAll()
        {
            float multiply = cubeScale / VoxelUtils.CHUNK_SIZE;

            voxelsLevelChunk.newLevel();
            voxelsLevelChunk.subtractChunk(new Vector3((int)(_v3StartPos.x * multiply), (int)(_v3StartPos.y * multiply), (int)(_v3StartPos.z * multiply)), new Vector3(multiply, multiply, multiply));

            _aGridCubes = new GridCube[_numCubesPerAxis, _numCubesPerAxis, _numCubesPerAxis];

            _aPath.Clear();

            foreach (Transform child in gridContainer.transform)
            {
                Destroy(child.gameObject);
            }
        }
        //
        public void createNewLevel()
        {
            if (!AppController.Instance.editorIsInOfflineMode)
            {
                return;
            }

            LevelData.Instance.lastLevelName = Globals.defaultLevelName;

            //_curLevelChunk.reset ();
            //_curLevelChunk.createOfflineLevel ();
            _curVoxelsLevelChunk.newLevel();

            Vector3 savedPos = Vector3.zero;
            Vector3 savedRot = Vector2.zero;

            savedPos.x = (VoxelUtils.MAX_CHUNK_UNITS * VoxelUtils.CHUNK_SIZE * .5f);
            savedPos.y = (VoxelUtils.MAX_CHUNK_UNITS * VoxelUtils.CHUNK_SIZE * .5f);
            savedPos.z = (VoxelUtils.MAX_CHUNK_UNITS * VoxelUtils.CHUNK_SIZE * .5f) - 1.0f;
            FlyCam.Instance.setNewInitialPosition(savedPos, savedRot);
            resetCamToStartPos();

            setMode(AppState.Select, true);
        }