Exemple #1
0
        public void loadLevel(SpectrumEnums.Levels level)
        {
            currentLevel = level;
            Spectrum.lastPlayedLevel = level;
            models.Add(new SkySphere(skySphereModel, game, ((Spectrum)Game).camera, this));
            ((Spectrum)game).getCurrentActFromCurrentLevel();
            levelCreator.loadLevel(currentLevel);
            mapResolution = levelCreator.getCurrentMapResolution();
            ((Spectrum)game).getCurrentActFromCurrentLevel();
            ((Spectrum)game).soundManager.playMusic();
            Vector3 startPosition = levelCreator.getStartPosition();
            Vector3 startDirection = Vector3.Zero;
            Vector3 startUp = Vector3.Zero;
            enemies = levelCreator.getEnemies();
            countLevelInk();

            Vector3 dim = levelCreator.getCurrentMapResolution();
            OctTree octree = new OctTree(-2, -2, -2, (dim.Z * 2) + 2, (dim.Y * 2) + 2, (dim.X * 2) + 2);
            foreach(BasicCube cube in worldMap)
            {
                octree.Insert(cube);
            }

            foreach (Googoo enemy in enemies)
            {
                enemy.setAStar(worldMap, mapResolution);
                enemy.setOctTree(octree);
                enemy.InitializePathfinding();
            }

            player = new Bubble(bubbleModel, game, ((Spectrum)Game).camera, octree, startPosition, startDirection, startUp, worldMap, screenManager);
            player.setLives(levelCreator.getLivesInLevel());
            models.Add(player);
        }