当前位置: 首页>>代码示例>>C#>>正文


C# Coords.getX方法代码示例

本文整理汇总了C#中Coords.getX方法的典型用法代码示例。如果您正苦于以下问题:C# Coords.getX方法的具体用法?C# Coords.getX怎么用?C# Coords.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Coords的用法示例。


在下文中一共展示了Coords.getX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getMovementActionType

 public static Action getMovementActionType(Coords from, Coords to)
 {
     if (to.getX () == from.getX () + 1) {
         return new Action (Action.ActionType.EAST);
     } else if (to.getX () == from.getX () - 1) {
         return new Action (Action.ActionType.WEST);
     } else if (to.getY () == from.getY () + 1) {
         return new Action (Action.ActionType.SOUTH);
     } else {
         return new Action (Action.ActionType.NORTH);
     }
 }
开发者ID:vermagav,项目名称:bombersquad,代码行数:12,代码来源:MovementUtil.cs

示例2: explodeBomb

        //chain reaction... explodes bombs encountered as well
        private void explodeBomb(Coords bombCoord)
        {
            //remove bomb
            //explode in manhattan radius, killing everything in path and destroying first wall encountered
            LocationData datum = GetLocationData (bombCoord);
            LocationData.Tile bomb = LocationData.Tile.BOMB;
            datum.RemoveObject (bomb);
            this.liveBombs.Remove (bombCoord);

            PlayerState bombOwner = datum.BombOwner;
            bombOwner.Bombs = bombOwner.Bombs + 1;

            explosionUpdate (bombCoord);

            //chain reaction...

            int radius = datum.ExplosionRadius;

            int x = bombCoord.getX ();
            int y = bombCoord.getY ();
            //search every cardinal direction... blow up any player encountered and first destructible wall encountered
            //west
            for (int i = 1; i <= radius; i++) {
                try {
                    Coords next = Coords.coordsXY (x - i, y, width, height);
                    bool halt = explosionUpdate (next);
                    if (halt) {
                        break;
                    }
                } catch (ArgumentException e) {
                    break;
                }
            }

            //north
            for (int i = 1; i <= radius; i++) {
                try {
                    Coords next = Coords.coordsXY (x, y - i, width, height);
                    bool halt = explosionUpdate (next);
                    if (halt) {
                        break;
                    }
                } catch (ArgumentException e) {
                    break;
                }
            }

            //south
            for (int i = 1; i <= radius; i++) {
                try {
                    Coords next = Coords.coordsXY (x, y + i, width, height);
                    bool halt = explosionUpdate (next);
                    if (halt) {
                        break;
                    }
                } catch (ArgumentException e) {
                    break;
                }
            }

            //east
            for (int i = 1; i <= radius; i++) {
                try {
                    Coords next = Coords.coordsXY (x + i, y, width, height);
                    bool halt = explosionUpdate (next);
                    if (halt) {
                        break;
                    }
                } catch (ArgumentException e) {
                    break;
                }
            }
        }
开发者ID:vermagav,项目名称:bombersquad,代码行数:74,代码来源:GameState.cs

示例3: SetLocationData

 public void SetLocationData(LocationData locationData, Coords coords)
 {
     int x = coords.getX ();
     int y = coords.getY ();
     this.map [x, y] = locationData;
 }
开发者ID:vermagav,项目名称:bombersquad,代码行数:6,代码来源:GameState.cs

示例4: GetLocationData

 public LocationData GetLocationData(Coords coord)
 {
     int x = coord.getX ();
     int y = coord.getY ();
     return this.GetLocationData (x, y);
 }
开发者ID:vermagav,项目名称:bombersquad,代码行数:6,代码来源:GameState.cs

示例5: manhattanDist

 public static int manhattanDist(Coords from, Coords to)
 {
     int distance = Math.Abs (from.getX () - to.getX ()) + Math.Abs (from.getY () - to.getY ());
     return distance;
 }
开发者ID:vermagav,项目名称:bombersquad,代码行数:5,代码来源:MovementUtil.cs


注:本文中的Coords.getX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。