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


C# Tile.getDoor方法代码示例

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


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

示例1: placeWalls

	private void placeWalls(Tile tile, FullRoom f)
	{
		List<GameObject> wallsToAdd = new List<GameObject>();
		List<Vector3> posToAdd = new List<Vector3>();
		List<Quaternion> rotToAdd = new List<Quaternion>();
		for (int i = 0; i < 4; ++i)
		{
			if (tile.getDoor (i))
			{
				Object temp = new Object();
				temp = walls[0];
				switch(i)
				{
				case 1:
				{
					if (!doorPlaced (tile, i))
					{
						GameObject wall = new GameObject();
						wall = temp as GameObject;
						posToAdd.Add (new Vector3(roomPos.x + 20.005f, 5, roomPos.z + 12.5f));
						wallsToAdd.Add (wall);
						rotToAdd.Add (new Quaternion());
						//Instantiate(temp, new Vector3(roomPos.x + 20.005f, 5, roomPos.z + 12.5f), new Quaternion());
						tile.setPlacedDoor(i);
					}
					break;
				}
				case 3:
				{
					if (!doorPlaced (tile, i))
					{
						GameObject wall = new GameObject();
						wall = temp as GameObject;
						posToAdd.Add(new Vector3(roomPos.x - 20.005f, 5, roomPos.z - 12.5f));
						wallsToAdd.Add (wall);
						rotToAdd.Add(new Quaternion());
						//Instantiate(temp, new Vector3(roomPos.x - 20.005f, 5, roomPos.z - 12.5f), new Quaternion());
						tile.setPlacedDoor(i);
					}
					break;
				}
				case 0:
				{
					if (!doorPlaced (tile, i))
					{
						GameObject g = new GameObject();
						g = temp as GameObject;
						g.transform.Rotate(90, 0, 0);
						posToAdd.Add(new Vector3(roomPos.x - 12.5f, 5, roomPos.z - 20.005f));
						wallsToAdd.Add (g);
						rotToAdd.Add(g.transform.rotation);
						//Instantiate(g, new Vector3(roomPos.x - 12.5f, 5, roomPos.z - 20.005f), g.transform.rotation);
						g.transform.Rotate(-90, 0, 0);
						tile.setPlacedDoor(i);
					}
					break;
				}
				case 2:
				{
					if (!doorPlaced (tile, i))
					{
						GameObject g = new GameObject();
						g = temp as GameObject;
						g.transform.Rotate(90, 0, 0);
						posToAdd.Add( new Vector3(roomPos.x + 12.5f, 5, roomPos.z + 20.005f));
						
						wallsToAdd.Add (g);
						rotToAdd.Add(g.transform.rotation);
						//Instantiate(g, new Vector3(roomPos.x + 12.5f, 5, roomPos.z + 20.005f), g.transform.rotation);
						g.transform.Rotate(-90, 0, 0);
						tile.setPlacedDoor(i);
					}
					break;
				}
				}
			}
			else
			{
				Object temp = new Object();
				temp = walls[1];
				switch(i)
				{
				case 1:
				{
					GameObject wall = temp as GameObject;
					posToAdd.Add(new Vector3(roomPos.x + 20.005f, 5, roomPos.z));
					wallsToAdd.Add (wall);
					rotToAdd.Add(new Quaternion());
					//Instantiate(temp, new Vector3(roomPos.x + 20.005f, 5, roomPos.z), new Quaternion());
					break;
				}
				case 3:
				{
					GameObject wall = temp as GameObject;
					posToAdd.Add(new Vector3(roomPos.x - 20.005f, 5, roomPos.z));
					wallsToAdd.Add (wall);
					rotToAdd.Add(new Quaternion());
					//Instantiate(temp, new Vector3(roomPos.x - 20.005f, 5, roomPos.z), new Quaternion());
					break;
				}
//.........这里部分代码省略.........
开发者ID:FlingWhale,项目名称:Unity-FPS,代码行数:101,代码来源:RenderMap.cs

示例2: pickRoom

	private Object pickRoom(Tile tile)
	{
		if (tile.getTag() == "S") // startRoom
		{
			player.transform.position = new Vector3(roomPos.x, 2, roomPos.z);
			return rooms[0];
		}

		if (tile.getTag () == "B")
		{
			return rooms[0];
		}

		if (tile.getTag () == "T") // startRoom
		{	
			return rooms[6];
		}

		if (tile.getDoor(0) && tile.getDoor (2) && !tile.getDoor(1) && /*!tile.getDoor (3) && */ (Random.Range (0, 100) <= 75))
		{
			return rooms[5];
		}
		
		return rooms[Random.Range(0, 5)];
	}
开发者ID:FlingWhale,项目名称:Unity-FPS,代码行数:25,代码来源:RenderMap.cs


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