Esempio n. 1
0
        protected void OverlayAttackPattern(ICell cell, Direction direction, Attack attack)
        {
            bool[,] rotatedAttackPattern = Rotate(direction);
            Point center = new Point((rotatedAttackPattern.GetLength(0) - 1) / 2, (rotatedAttackPattern.GetLength(1) - 1) / 2);

            for (int y = 0; y < rotatedAttackPattern.GetLength(1); y++)
            {
                for (int x = 0; x < rotatedAttackPattern.GetLength(0); x++)
                {
                    if (rotatedAttackPattern[y, x])
                    {
                        int yOffset = (center.Y - y);
                        int xOffset = (center.X - x);
                        attack.AddArea(GetCell(cell.X - xOffset, cell.Y - yOffset));
                    }
                }
            }
        }