代码块测试

今天新开始使用博客,还没试过如何插入代码块,并支持浏览时折叠功能

View Code
 1  List<Point> GetRange(Point center, AttackRangeTypes attackRangeType, int range) {
 2             List<Point> points = new List<Point>();
 3             for (int x = -range; x <= range; x++) {
 4                 for (int y = -range; y <= range; y++) {
 5                     switch (attackRangeType) {
 6                         case AttackRangeTypes.None:
 7                             continue;
 8                         case AttackRangeTypes.Square:
 9                             break;
10                         case AttackRangeTypes.Diamond:
11                             if (Math.Abs(x) + Math.Abs(y) > range) { continue; }
12                             break;
13                         case AttackRangeTypes.Cross:
14                             if (Math.Abs(x) != 0 && Math.Abs(y) != 0) { continue; }
15                             break;
16                         case AttackRangeTypes.Oblique:
17                             if (Math.Abs(x) != Math.Abs(y)) { continue; }
18                             break;
19                     }
20                     points.Add(new Point(center.X + x, center.Y + y));
21                 }
22             }
23             return points;
24         }

 

posted @ 2012-11-10 19:36  xpycy  阅读(123)  评论(0编辑  收藏  举报