本文整理汇总了C#中Coords.getY方法的典型用法代码示例。如果您正苦于以下问题:C# Coords.getY方法的具体用法?C# Coords.getY怎么用?C# Coords.getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coords
的用法示例。
在下文中一共展示了Coords.getY方法的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);
}
}
示例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;
}
}
}
示例3: SetLocationData
public void SetLocationData(LocationData locationData, Coords coords)
{
int x = coords.getX ();
int y = coords.getY ();
this.map [x, y] = locationData;
}
示例4: GetLocationData
public LocationData GetLocationData(Coords coord)
{
int x = coord.getX ();
int y = coord.getY ();
return this.GetLocationData (x, y);
}
示例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;
}