示例#1
0
        public void RestartMapWon()
        {
            try
            {
                if (activeSkills != null)
                {
                    world.RemoveBody(activeSkills.shieldGfx.body);
                    activeSkills = null;
                }

                foreach (AI ai in theAI)
                {
                    ai.projectile.Clear(world);
                    world.RemoveBody(ai.wheel.body);
                    world.RemoveBody(ai.torso.body);
                }
                theAI.Clear();

                if (drops.Count > 0)
                {
                    foreach (Drops d in drops)
                    {
                        world.RemoveBody(d.hpBox.body);
                        world.RemoveBody(d.ethanolBox.body);
                    }
                }

                if (player != null)
                    player.projectile.Clear(world);

                //player.torso.Position = new Vector2(60, 1300);
                player.MovePlayer(new Vector2(60, 1300));
                if (map != null)
                {
                    map.InializeMap();
                }

                //reset spawnpoints
                foreach (Spawn sp in spawnpoints)
                {
                    if (sp.Visited)
                        sp.Visited = false;
                }

                drops.Clear();

                menu.totalTime = 0f;

                runTime = 0;
                player.torso.Position = new Vector2(60, 1300);
                player.wheel.Position = new Vector2(60, 1300);
                camera = new Camera(graphics.GraphicsDevice.Viewport);
                camera.UpdateCamera(player);

                /*
                            if (quest != null)
                            {
                                world.RemoveBody(quest.boulder.body);
                            }

                            quest = new Quests(world, this);
                            if (map != null)
                                map.button.body.OnCollision += quest.InteractWithQuestItems;
                 * */

            }
            catch (Exception ex)
            {
                logger.Fatal("Restart: " + ex.Message + "  " + ex.TargetSite + "  " + ex.StackTrace);
            }
        }
示例#2
0
        /// <summary>
        /// Restart the game
        /// </summary>
        public void Restart()
        {
            try
            {
                if (activeSkills != null)
                {
                    world.RemoveBody(activeSkills.shieldGfx.body);
                    activeSkills = null;
                }

                foreach (AI ai in theAI)
                {
                    ai.projectile.Clear(world);
                    world.RemoveBody(ai.wheel.body);
                    world.RemoveBody(ai.torso.body);
                }
                theAI.Clear();

                if (player != null)
                {
                    world.RemoveBody(player.torso.body);
                    world.RemoveBody(player.wheel.body);
                }

                if (drops.Count > 0)
                {
                    foreach (Drops d in drops)
                    {
                        world.RemoveBody(d.hpBox.body);
                        world.RemoveBody(d.ethanolBox.body);

                    }
                }

                if (player != null)
                    player.projectile.Clear(world);

                player = null;

                //starta i slutet av banan (låt va kvar /Timmo)
                if (endOfMapSpawn)
                    player = new Player(world, playerTexture, new Vector2(42, 90), 10.0f, new Vector2(8385, 1000), this, "player");
                else
                    player = new Player(world, playerTexture, new Vector2(60, 88), 10.0f, new Vector2(60, 1300), this, "player");

                if (map != null)
                {
                    map.InializeMap();
                }

                //reset spawnpoints
                foreach (Spawn sp in spawnpoints)
                {
                    if (sp.Visited)
                        sp.Visited = false;
                }

                drops.Clear();

                menu.totalTime = 0f;

                runTime = 0;

                camera = new Camera(graphics.GraphicsDevice.Viewport);
                camera.UpdateCamera(player);

                /*
                            if (quest != null)
                            {
                                world.RemoveBody(quest.boulder.body);
                            }

                            quest = new Quests(world, this);
                            if (map != null)
                                map.button.body.OnCollision += quest.InteractWithQuestItems;
                 * */

                skilltree = new Skilltree(player, this);

            }
            catch (Exception ex)
            {
                logger.Fatal("Restart: " + ex.Message + "  " + ex.TargetSite + "  " +  ex.StackTrace);
            }
        }