예제 #1
0
        /**
         * This function is called when a scene is made active.
         */
        public override void loadScene(ContentManager content)
        {
            collidables = new List<Entity>();

            if (content == null)
                content = new ContentManager(SceneManager.Game.Services, "Content");

            // Load the shader
            HLSLeffect = content.Load<Effect>("Effects/Shader");

            if (!loaded)
            {
                GameSave.seed = Environment.TickCount;

                GameSave.level = controller.getLevel();
                GameSave.partyHealth = PartyUtils.getPartyHealth();
                GameSave.score = controller.getScore();
                //SAVE
                SaveUtils.getInstance().saveGame(GameSave);

                controller.setGenerator(new Random(GameSave.seed));
            }

            // Generate the arena
            ArenaBuilder builder = new ArenaBuilder(controller.getLevelSize(), controller.getLevelSize(),
                content, SceneManager.GraphicsDevice.Viewport.AspectRatio, controller.getLevelDifficulty());
            baseArena = builder.buildArenaBase();
            StartTile = builder.getStartTile();

            //
            if (effect == null)
                effect = new BasicEffect(SceneManager.Game.GraphicsDevice);//null

            FlashLightAngle = MIN_FLASH;
            Hero = new Character();
            camera = new Camera(effect, SceneManager.Game.Window.ClientBounds.Width, SceneManager.Game.Window.ClientBounds.Height, SceneManager.GraphicsDevice.Viewport.AspectRatio, Hero.getPOSITION());
            //load model
            Hero.LoadModel(content, SceneManager.GraphicsDevice.Viewport.AspectRatio);

            table = new ArenaTable(getStartTile(), content);
            skybox = new ArenaSkybox(getStartTile(), content);

            potionsUsed = 0;
            MysteryBoxUsed = false;

            //load CombatInfo at top left
            Vector2 start = new Vector2(10, 45);
            foreach (PlayerSprite ps in PartyUtils.getParty())
            {
                ps.getCombatInfo().init(content, start);
                start.Y += 60;
            }

            pauseMenu.load(content, SceneManager.GraphicsDevice.Viewport);
            pauseMenu.center();

            // Load the level start conversation
            currentConversation = DialogueUtils.makeConversation((ConversationType)controller.getLevel() - 1);
            currentConversation.load(content);

            //load score dispaly
            ScoreDisplay = new Scoring();
            ScoreDisplay.load(content);
        }
예제 #2
0
        /// <summary>
        /// This function reloads the arena with a new difficulty.
        /// </summary>
        /// <param name="difficulty">The new arena's difficulty</param>
        public void loadNewArena(ArenaDifficulty difficulty)
        {
            collidables = new List<Entity>();

            if (content == null)
                content = new ContentManager(SceneManager.Game.Services, "Content");

            //populate the GameSave object
            GameSave.seed = Environment.TickCount;
            GameSave.level = controller.getLevel();
            GameSave.partyHealth = PartyUtils.getPartyHealth();
            GameSave.score = controller.getScore();
            //SAVE
            SaveUtils.getInstance().saveGame(GameSave);

            controller.setGenerator(new Random(GameSave.seed));

            // Set the new ambience colour
            ambientColour = controller.getAmbience();

            // Generate the arena
            ArenaBuilder builder = new ArenaBuilder(controller.getLevelSize(), controller.getLevelSize(),
                content, SceneManager.GraphicsDevice.Viewport.AspectRatio, difficulty);
            baseArena = builder.buildArenaBase();
            StartTile = builder.getStartTile();

            //
            if (effect == null)
                effect = new BasicEffect(SceneManager.Game.GraphicsDevice);//null

            Hero = new Character();
            camera = new Camera(effect, SceneManager.Game.Window.ClientBounds.Width, SceneManager.Game.Window.ClientBounds.Height, SceneManager.GraphicsDevice.Viewport.AspectRatio, Hero.getPOSITION());
            //load model
            Hero.LoadModel(content, SceneManager.GraphicsDevice.Viewport.AspectRatio);
            potionsUsed = 0;
            MysteryBoxUsed = false;

            // Load the level start conversation
            currentConversation = DialogueUtils.makeConversation((ConversationType)controller.getLevel() - 1);
            currentConversation.load(content);

            //load score dispaly
            ScoreDisplay = new Scoring();
            ScoreDisplay.load(content);

            // Debug arena
            printDebugArena();
        }