private static Goal LoadGoal(XmlElement node, ContentManager Content) { Vector2 position = new Vector2(); position.X = Convert.ToInt16(node.Attributes["x"].Value); position.Y = Convert.ToInt16(node.Attributes["y"].Value); Goal goal = new Goal(Content.Load<Texture2D>("Texture/goal"), position); return goal; }
//public EditableLevel(ContentManager content) { // _platforms = new List<Platform>(); // _treasures = new List<Treasure>(); // _deathTraps = new List<DeathTrap>(); // _moveablePlatforms = new List<Platform>(); // _attempts = 4; // _parTime = 1; // _additionsAllowed = 30; // typesAllowed = "RBHV"; // _ballTex = content.Load<Texture2D>("Texture/ball"); // Background = content.Load<Texture2D>("Texture/GameScreen"); // _custom = true; //} /// <summary> /// Constructs a EditableLevel object. /// </summary> /// <param name="level">The Level to use to create the simulation.</param> /// <param name="content">The ContentManager to use to load the ball texture.</param> public EditableLevel(Level level, ContentManager content) { // TODO: This clones the list, but references the same platforms. // If gameplay may modify properties of platforms (or the goal, // or the launcher), a deep copy is necessary instead. _platforms = new List<Platform>(level.Platforms); _treasures = new List<Treasure>(level.Treasures); _deathTraps = new List<DeathTrap>(level.DeathTraps); _goal = level.Goal; _launcher = level.Launcher; _moveablePlatforms = new List<Platform>(); Name = level.Name; _attempts = level.Attempts; _parTime = level.ParTime; //hard coded amount of additions. _additionsAllowed = 3; Background = content.Load<Texture2D>("Texture/GameScreen"); typesAllowed = level.AllowedPlatTypes; // Load the ball's texture and store it. _ballTex = content.Load<Texture2D>("Texture/ball"); _custom = false; // Allow the user to interact with the simulation, and start the timer. // _currentState = SimulationState.Active; }
/// <summary> /// Constructs a Simulation object. /// </summary> /// <param name="level">The Level to use to create the simulation.</param> /// <param name="content">The ContentManager to use to load the ball texture.</param> public Simulation(Level level, ContentManager content) { // TODO: This clones the list, but references the same platforms. // If gameplay may modify properties of platforms (or the goal, // or the launcher), a deep copy is necessary instead. _platforms = new List<Platform>(level.Platforms); _treasures = new List<Treasure>(level.Treasures); _deathTraps = new List<DeathTrap>(level.DeathTraps); _goal = level.Goal; _launcher = level.Launcher; _moveablePlatforms = new List<Platform>(); _name = level.Name; // Initialize various stats. _startingAttempts = level.Attempts; _parTime = level.ParTime; _attemptsLeft = _startingAttempts; _collectedTreasures = 0; _bounces = 0; //hard coded amount of additions. _additionsAllowed = 3; Background = content.Load<Texture2D>("Texture/GameScreen"); // Load the ball's texture and store it. _ballTex = content.Load<Texture2D>("Texture/ball"); // Create the physics simulation. //InitWorld(); // Allow the user to interact with the simulation, and start the timer. _currentState = SimulationState.Active; _elapsedTime = 0f; }