示例#1
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();
        }
示例#2
0
        /// <summary>
        /// The base arena builder constructor
        /// </summary>
        /// <param name="width">The width of the arena</param>
        /// <param name="height">The height of the arena</param>
        /// <param name="Content">The content manager to use for loading</param>
        /// <param name="aspectRatio">The aspect ratio of the screen</param>
        /// <param name="difficulty">The difficulty of the arena</param>
        public ArenaBuilder(int width, int height, ContentManager Content, float aspectRatio, ArenaDifficulty difficulty)
        {
            instance = this;
            r = ArenaController.instance.getGenerator();

            this.width = width;
            this.height = height;
            this.Content = Content;
            this.difficulty = difficulty;
        }