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


C# MapPoint.toInt方法代码示例

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


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

示例1: SetRedPhantom

	public void SetRedPhantom(MapPoint p)
	{
		Transform ph= null;
		if(phantoms.TryGetValue(p.toInt(),out ph))
		{
			Destroy(ph.gameObject);
			phantoms.Remove(p.toInt());
		}

		InstantiatePhantom(p,false);
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:11,代码来源:PhantomController.cs

示例2: InstantiatePhantom

	void InstantiatePhantom(MapPoint p, bool isGreen)
	{
		Transform ph = Instantiate<Transform>(isGreen?Green:Red);
		ph.parent = transform;
		ph.localPosition = new Vector3(p.X+0.5f,p.Y+0.5f,0);
		phantoms.Add(p.toInt(),ph);
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:7,代码来源:PhantomController.cs

示例3: Process

	public bool Process (Segmentator s, Room r)
	{
		processed = new List<LogicCell>();
		Dictionary<Door,LogicCell> doorCells = new Dictionary<Door, LogicCell>();
		foreach(Door d in r.Doors)
		{
			if(doorCells.ContainsKey(d))
				continue;
			LogicCell c = null;
			MapPoint p = null;

			p =new MapPoint(d.Position.X,d.Position.Y);
			if(r.LogicCells.TryGetValue(p.toInt(),out c) && !processed.Contains(c))
			{
				processed.Add(c);
				doorCells.Add(d,c);
				continue;
			}

			p =new MapPoint(d.Position.X-1,d.Position.Y);
			if(r.LogicCells.TryGetValue(p.toInt(),out c) && !processed.Contains(c))
			{
				processed.Add(c);
				doorCells.Add(d,c);
				continue;
			}

			p =new MapPoint(d.Position.X,d.Position.Y-1);
			if(r.LogicCells.TryGetValue(p.toInt(),out c) && !processed.Contains(c))
			{
				processed.Add(c);
				doorCells.Add(d,c);
				continue;
			}

			p =new MapPoint(d.Position.X-1,d.Position.Y-1);
			if(r.LogicCells.TryGetValue(p.toInt(),out c) && !processed.Contains(c))
			{
				processed.Add(c);
				doorCells.Add(d,c);
				continue;
			}


		}

		toProcess = new List<LogicCell>(doorCells.Values);
		if(toProcess.Count==0)
			return false;

		processed.Clear();

		Recursive(toProcess[0]);

		if(toProcess.Count>0)
			return true;

		return false;
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:59,代码来源:NarrowCoridor.cs

示例4: Process

	public bool Process (Segmentator s, Room r)
	{
		if(r.TypeOfRoom!=RoomType.Dining ||
		   r.TypeOfRoom!=RoomType.Kitchen)
			return false;

		List<LogicHob> hobs = r.GetObjects<LogicHob>();
		foreach(LogicHob h in hobs)
		{
			MapPoint pos = new MapPoint(h.ObjectRect.MinX,h.ObjectRect.MinY);
			LogicCell cell = r.LogicCells[pos.toInt()];
			if(cell.ReachableCells.Count==4)
				return true;
		}

		return false;
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:17,代码来源:StrangeHob.cs

示例5: EditorSetCell

	public CellController EditorSetCell(MapPoint point, CellController prefab)
	{
		if(point.X<0 || point.Y<0 || point.X>0xffff || point.Y>0xffff)
			return  null;
		
		CellController newCell = null;
		int key = point.toInt();
		if(!cells.ContainsKey(key))
		{
			newCell = CellController.InstantiateMe(prefab,transform,point);
			cells.Add(key,newCell);
		}
		else
			newCell = cells[key];
		
		return newCell;
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:17,代码来源:HouseController.cs

示例6: EditorRemoveCell

	public void EditorRemoveCell(MapPoint point)
	{
		if(point.X<0 || point.Y<0 || point.X>0xffff || point.Y>0xffff)
			return;

		int key = point.toInt();
		if(!cells.ContainsKey(key))
			return;

		DestroyImmediate(cells[key].gameObject);
		cells.Remove(key);

	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:13,代码来源:HouseController.cs

示例7: OnRemoveObject

	private void OnRemoveObject(Vector3 pz)
	{
		MapPoint mp = new MapPoint(Mathf.FloorToInt(pz.x),Mathf.FloorToInt(pz.y));
		CellController cellToRemove = null;
		if(cells.TryGetValue(mp.toInt(),out cellToRemove))
		{

			if(cellToRemove.CellObject!=null)
				M.UI.bCostsPanel.Expences.AddValue(-cellToRemove.CellObject.GetCost());

			MapRect rect = cellToRemove.GetCellIndexes(cellToRemove.Position,cellToRemove.Rotation);
			rect.Foreach( (MapPoint p) => {
				cells.Remove(p.toInt());
				EditorSetCell(p,CellPrefab);
			});
			Destroy(cellToRemove.gameObject);
		}
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:18,代码来源:HouseController.cs

示例8: GetCell

	public CellController GetCell(MapPoint point)
	{
		if(point.X<0 || point.Y<0 || point.X>0xffff || point.Y>0xffff)
			return null;

		int key = point.toInt();
		if(cells.ContainsKey(key))
			return cells[key];

		return null;
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:11,代码来源:HouseController.cs


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