本文整理汇总了C#中Coord.isOOB方法的典型用法代码示例。如果您正苦于以下问题:C# Coord.isOOB方法的具体用法?C# Coord.isOOB怎么用?C# Coord.isOOB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coord
的用法示例。
在下文中一共展示了Coord.isOOB方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: makeLine
// Generate a line from one coordinate to another
// You can ask for it to be totaly walls or totally floor, based on the bool
// False: Walls
// True: Floor
public static void makeLine(Tile[,] map, Coord begin, Coord end, bool applyFloor) {
// Assert in range
if( begin.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) ||
end.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) )
return;
int startX = begin.x;
int endX = end.x;
int startY = begin.y;
int endY = end.y;
// Find the linear spacing appropriate from point
// including the endpoint
int lengthX = Math.Abs( endX - startX );
var linspace = new List<Double>();
linspace = LinSpace (startY, endY, lengthX, true).ToList ();
// Now it's time to actually put our money where our mouth is
for(int i = startX; i < endX; i++) {
int j = (int) linspace[i] ;
map[i,j].property = applyFloor ? TileType.Floor1 : TileType.OuterWall1;
}
// Phew! Thought this one was so easy, didn't cha!?
return;
}
示例2: makeRectangle
// Generate a rectangle starting from the topleft point to the bottomright point
// You can ask for it to be totally walls or totally floor, based on the bool
// False: Walls
// True: Floor
public static void makeRectangle(Tile[,] map, Coord topLeft, Coord bottomRight, bool applyFloor) {
// Assert that topLeft and bottomRight are in range
if( topLeft.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) ||
bottomRight.isOOB (map.GetLength(0), map.GetLength (1), Direction.Stop) )
return;
int startX = topLeft.x;
int endX = bottomRight.x;
int startY = bottomRight.y;
int endY = topLeft.y;
for(int i = startX; i < endX; i++) {
for(int j = startY; j < endY; j++) {
map[i,j].property = applyFloor ? TileType.Floor1 : TileType.OuterWall1;
}
}
return;
}
示例3: isSolid
/**
* isSolid is a boolean function that checks
* if a tile is on top of a "wall" or is OOB.
*/
public bool isSolid(Tile[,] map, Coord target) {
int rows = map.GetLength (0);
int columns = map.GetLength (1);
if(target.isOOB (rows,columns,Direction.Stop)) return true;
//Debug.Log (map[target.x, target.y].property);
return ( map[target.x, target.y].property == TileType.OuterWall1 );
}