本文整理汇总了C#中Cluster.GetGrid方法的典型用法代码示例。如果您正苦于以下问题:C# Cluster.GetGrid方法的具体用法?C# Cluster.GetGrid怎么用?C# Cluster.GetGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cluster
的用法示例。
在下文中一共展示了Cluster.GetGrid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindPortalsVertical
private void FindPortalsVertical(Cluster c1, Cluster c2)
{
if (c1 == null || c2 == null)
return;
if (!c1.updated && !c2.updated)
return;
Tile[,] g1 = c1.GetGrid ();
Tile[,] g2 = c2.GetGrid ();
int max = Cluster.size - 1;
Portal currentPort1 = null;
Portal currentPort2 = null;
bool isTracking = false;
for (int i = 0; i < Cluster.size; i++) {
if (g1 [max, i].cost < 255 && g2 [0, i].cost < 255) {
if (isTracking) {
currentPort1.AddTile (g1 [max, i]);
currentPort2.AddTile (g2 [0, i]);
} else {
isTracking = true;
currentPort1 = new Portal (c1);
currentPort2 = new Portal (c2);
currentPort1.AddTile (g1 [max, i]);
currentPort2.AddTile (g2 [0, i]);
}
} else {
if (isTracking) {
Portal.Connect (currentPort1, currentPort2, 1);
AddPortal (currentPort1);
AddPortal (currentPort2);
isTracking = false;
}
}
}
if (isTracking) {
Portal.Connect (currentPort1, currentPort2, 1);
AddPortal (currentPort1);
AddPortal (currentPort2);
isTracking = false;
}
}