public ShipGoldView(Game game, IShip ship, GoldViewPosition position , SpriteBatch spriteBatch, float displayWidth) : base(game) { this.ship = ship; this.spriteBatch = spriteBatch; this.displayWidth = displayWidth; scale = 1f; this.DisplayCorner = position; }
private List<Vector2> CalculateGoldCoinPositions(float displayWidth, GoldViewPosition displayCorner) { Vector2 position; switch (displayCorner) { case GoldViewPosition.UpperLeft: position = new Vector2( 10, 10); break; case GoldViewPosition.UpperRight: position = new Vector2( 1280 - displayWidth - 10, 10); break; case GoldViewPosition.LowerLeft: position = new Vector2( 10, 720 - texture.Height - 10); break; case GoldViewPosition.LowerRight: position = new Vector2( 1280 - displayWidth - 10, 720 - texture.Height - 10); break; default: throw new ArgumentOutOfRangeException("displayCorner", "Unknown gold position"); } float increment = displayWidth / ship.GoldCapacity; var goldPositions = new List<Vector2>(); for (int i = 0; i < ship.GoldCapacity; i++) { var offset = new Vector2(i * increment, 0); goldPositions.Add(position + offset); } return goldPositions; }