/// <summary> /// Loads graphics content for this screen. This uses the shared ContentManager /// provided by the Game class, so the content will remain loaded forever. /// Whenever a subsequent MessageBoxScreen tries to load this same content, /// it will just get back another reference to the already loaded data. /// </summary> public override void LoadContent(ContentManager shared) { base.LoadContent(shared); _gradientTexture = shared.Load<Texture2D>("Texture/gradient"); _font = shared.Load<SpriteFont>("Font/menufont"); // Create the dictionaries and cache all the textures needed to draw each // platform in the toolbox. platformTextures = new Dictionary<Vector2, Texture2D>(); breakablePlatformTextures = new Dictionary<Vector2, Texture2D>(); foreach (Vector2 size in Platform.NormalPlatNames.Keys) { platformTextures.Add(size, shared.Load<Texture2D>(Platform.NormalPlatNames[size])); } foreach (Vector2 size in Platform.BreakablePlatNames.Keys) { breakablePlatformTextures.Add(size, shared.Load<Texture2D>(Platform.BreakablePlatNames[size])); } if (editableLevel.Custom) { deathTrap = new DeathTrap(shared.Load<Texture2D>("Texture/deathtrap"), new Vector2(200, 400)); treasure = new Treasure(shared.Load<Texture2D>("Texture/treasure"), new Vector2(300, 400)); } }
private Boolean Intersects(Treasure t, Point ms) { if (Vector2.Distance(t.Center, new Vector2(ms.X, ms.Y)) < Vector2.Distance(t.Center, t.Center + new Vector2(0, t.Width / 2))) { return true; } return false; }
private static Treasure LoadTreasure(XmlElement node, ContentManager Content) { Vector2 position = new Vector2(); position.X = Convert.ToInt16(node.Attributes["x"].Value); position.Y = Convert.ToInt16(node.Attributes["y"].Value); Treasure treasure = new Treasure(Content.Load<Texture2D>("Texture/treasure"), position); return treasure; }