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


C# Coord.isOOB方法代码示例

本文整理汇总了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;
	}
开发者ID:starrodkirby86,项目名称:Better-Game-App,代码行数:34,代码来源:RoomUtilityFunctions.cs

示例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;

	}
开发者ID:starrodkirby86,项目名称:Better-Game-App,代码行数:25,代码来源:RoomUtilityFunctions.cs

示例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 );
	}
开发者ID:starrodkirby86,项目名称:Better-Game-App,代码行数:15,代码来源:RoomUtilityFunctions.cs


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