Esempio n. 1
0
        public Battle(SPRWorld sprWorld, int botHalfWidth, World world, int currentLevel)
        {
            this.sprWorld = sprWorld;
            this.botHalfWidth = botHalfWidth;
            this.world = world;

            xmlDoc = new XmlDocument();

            if (nextAllies == "")
            {
                xmlDoc.Load("Games/SuperPowerRobots/Storage/Allies.xml");
            }
            else
            {
                xmlDoc.LoadXml(nextAllies);
            }

            //xmlDoc.

            XmlNodeList nodes = xmlDoc.GetElementsByTagName("Bot");

            Vector2[] edges = { new Vector2(-botHalfWidth, -botHalfWidth) * Settings.MetersPerPixel, new Vector2(botHalfWidth, -botHalfWidth) * Settings.MetersPerPixel, new Vector2(botHalfWidth, botHalfWidth) * Settings.MetersPerPixel, new Vector2(-botHalfWidth, botHalfWidth) * Settings.MetersPerPixel };

            CreateBots(nodes, edges);

            xmlDoc.Load("Games/SuperPowerRobots/Storage/Battles.xml");

            nodes = xmlDoc.GetElementsByTagName("Level");

            nodes = nodes[currentLevel].ChildNodes;

            CreateBots(nodes, edges);
        }
        // </DEBUG!!>
        /// <summary>
        /// Initializes a new instance of the <see cref="StupidGameScreen"/> class.
        /// </summary>
        /// <param name="scoreboardIndex">The game-specific index into the scoreboard.</param>
        public SPRGameScreen(int scoreboardIndex)
            : base(scoreboardIndex)
        {
            this.m_scoreboardIndex = scoreboardIndex;

            currentLevel = 0;
            scoreKeeper = new ScoreKeeper(true);

            previousGameTime = GameClock.Now;
            fantastica = new World(Vector2.Zero);
            Physics.Settings.MaxPolygonVertices = 30; // Defaults to 8? What are we, running on a TI-83 or something?
            Physics.Settings.EnableDiagnostics = false;
            this.sprWorld = new SPRWorld(fantastica, currentLevel);

            // Always call reset at the end of the constructor!
            this.Reset();
        }
        /// <summary>
        /// Resets this instance. This will be called when a new game is played. Reset all of
        /// your objects here so that you do not need to reallocate the memory for them.
        /// </summary>
        internal override void Reset()
        {
            base.Reset();
            currentLevel = 0;
            scoreKeeper = new ScoreKeeper(true);
            previousGameTime = GameClock.Now;
            fantastica = new World(Vector2.Zero);
            Physics.Settings.MaxPolygonVertices = 30; // Defaults to 8? What are we, running on a TI-83 or something?
            Physics.Settings.EnableDiagnostics = false;
            Battle.nextAllies = "";
            this.sprWorld = new SPRWorld(fantastica, currentLevel);

            this.gameOverTime = GameClock.Now + 10000000 * 10; // 10 Seconds.
        }
 public void NextLevel()
 {
     currentLevel += 1;
     fantastica = new World(Vector2.Zero);
     Physics.Settings.MaxPolygonVertices = 30; // Defaults to 8? What are we, running on a TI-83 or something?
     Physics.Settings.EnableDiagnostics = false;
     addedEndScreen = false;
     this.sprWorld = new SPRWorld(fantastica, currentLevel);
 }