/// <summary> /// Takes in an ObjectData sturcture and pulls all data from it, and stores it in the proper variables. Also takes in a texture to represent this object /// </summary> /// <param name="d">ObjectData structure. Loaded from main game through ContentPipeline</param> /// <param name="tex">Texture to represent object. Loaded from main game through ContentPipeline</param> public Object(ObjectData d, Texture2D tex) { speed = d.speed; position = Vector2.Zero;; image = d.image; texture = tex; origin = new Vector2(texture.Width / 2, texture.Height / 2); //angle and turnSpeed are stored as degrees in XML file. Convert to radians angle = MathHelper.ToRadians(d.angle); turnSpeed = MathHelper.ToRadians(d.turnSpeed); Bounding = new RectangleF(position, texture); }
/// <summary> /// Construct new PlayerInteractable from an ObjectData structure and a texture to represent this object /// </summary> /// <param name="d">ObjectData Structure loaded from main game from XML file through ContentPipeline</param> /// <param name="tex">Texture to represent this object</param> public PlayerInteractable(ObjectData d, Texture2D tex) : base(d, tex) { origin = new Vector2(tex.Width / 2, tex.Height / 2); }
/// <summary> /// Constructs new multiplier from an ObjectData structure and a texture /// </summary> /// <param name="d">ObjectData structure loaded from an XML file that is loaded from the ContentPipeline</param> /// <param name="tex">Texture to represent that image</param> public Multiplier(ObjectData d, Texture2D tex) : base(d, tex) { }
/// <summary> /// Construct a new health powerup. /// </summary> /// <param name="d">ObjectData structure loaded from an XML file through the ContentPipeline</param> /// <param name="tex">Texture to represent the powerup</param> public HealthPowerup(ObjectData d, Texture2D tex) : base(d, tex) { /*same constructor as PlayerInteractable*/ }