Пример #1
0
        public static void assignCoverToTile(Cover cover, Map battleMap)
        {
            int coverPositionX = cover.PositionX;
            int coverPositionY = cover.PositionY;

            Tile assignTile = battleMap.tiles[coverPositionX, coverPositionY];

            assignTile.cover = cover;
            assignTile.isOccupied = true;
        }
Пример #2
0
        public static List<Cover> createTestCover(Map map)
        {
            List<Cover> cover = new List<Cover>();

            Cover testPiece1 = new Cover(1, 2, "upper-left,lower-right");
            Cover testPiece2 = new Cover(2, 4, "upper-left,lower-right");
            Cover testPiece3 = new Cover(3, 3, "upper-left,lower-right");
            Cover testPiece4 = new Cover(19, 18, "upper-left,lower-right");
            Cover testPiece5 = new Cover(19, 19, "upper-left,lower-right");

            cover.Add(testPiece1);
            assignCoverToTile(testPiece1, map);
            cover.Add(testPiece2);
            assignCoverToTile(testPiece2, map);
            cover.Add(testPiece3);
            assignCoverToTile(testPiece3, map);
            cover.Add(testPiece4);
            assignCoverToTile(testPiece4, map);
            cover.Add(testPiece5);
            assignCoverToTile(testPiece5, map);

            return cover;
        }
Пример #3
0
        public static Rectangle GetSourceRect(Cover cover)
        {
            int xPos = 0;
            int yPos = 0;
            string orientation = cover.Orientation;

            switch (orientation)
            {
                    // 1/\2
                    // 3\/4

                case "upper-left,lower-right":
                    xPos = width + bufferWidth;
                    break;
                case "lower-left-,upper-right":
                    xPos = 2*(width + bufferWidth);
                    break;
                case "upper-left,upper-right":
                    yPos = height + bufferWidth;
                    break;
            }

            Rectangle sourceRect = new Rectangle(xPos, yPos, width, height);

            return sourceRect;
        }