Beispiel #1
0
        public ShipItem(Vector2 position, int linkPosition, RectangularHull hull, Part part, IDs id = IDs.DEFAULT) : base(position, id)
        {
            if (!id.Equals(IDs.RECTHULLPART))
            {
                angle = -(float)Math.PI / 2 * linkPosition;

                if (linkPosition % 2 == 0)
                {
                    angle += (float)Math.PI;
                }
            }
            Hull = hull;
            Part = part;
            //Width = Sprite.SpriteRect.Width * SCALEFACTOR;
            //Height = Sprite.SpriteRect.Height * SCALEFACTOR;
            LinkPosition = linkPosition;
        }
        internal void CreateItemBoxes()
        {
            itemBoxes = new List <UpgradeBarItem>();
            cols      = (int)Math.Ceiling((double)(itemBoxes.Count / rows));
            int   currentCol  = 0;
            float scaleFactor = 32 * ClickableItem.SCALEFACTOR;

            for (int i = 0; i < upgradePartsIDs.Count; i++)
            {
                if (i % (rows) == 0 && i != 0)
                {
                    currentCol++;
                }
                IDs tempID = upgradePartsIDs[i];
                if (tempID.Equals(IDs.EMPTYPART))
                {
                    tempID = IDs.HAMMERPART;
                }
                UpgradeBarItem u = new  UpgradeBarItem(new Vector2(currentCol * scaleFactor + spacing * (currentCol + 1) + offsetX,
                                                                   ((i - currentCol * (rows)) * scaleFactor + spacing * (i - currentCol * (rows)) + offsetY)), DrawHelper.UPGRADEFONT, tempID);
                itemBoxes.Insert(i, u);
            }
        }