本文整理汇总了C#中Tile.setPos方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.setPos方法的具体用法?C# Tile.setPos怎么用?C# Tile.setPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.setPos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: placeSpecialRoom
private bool placeSpecialRoom(Tile special)
{
specialRooms.Add (special);
bool ok;
if (special.getTag ().Equals ("S"))
{
special.setPos(floorSize / 2, floorSize / 2);
floor[special.getRow ()][special.getCol ()] = special;
return true;
}
//checks to see if the newly placed tile
//is the minimum distance away from every
//other specially placed tile
int tries = 0;
do
{
if (tries > 50)
{
return false;
}
ok = true;
special.setPos (gen.Next(0, floorSize), gen.Next(0, floorSize));
foreach (Tile i in specialRooms)
{
if (i.Equals(special)) continue;
//UnityEngine.Debug.Log (i.getTag () + special.getTag () + " DISTANCE: " + getDistance (i, special) + " MIN DISTANCE: " + minDistance );
if (getDistance (i, special) < minDistance)
{
ok = false;
break;
}
if (getDistance (i, special) > maxDistance)
{
ok = false;
break;
}
++tries;
}
}while (!ok);
floor[special.getRow ()][special.getCol ()] = special;
return true;
}
示例2: makeFloor
private void makeFloor()
{
for (int i = 0; i < floorSize; ++i)
{
List<Tile> row = new List<Tile>();
for (int j = 0; j < floorSize; ++j)
{
Tile t = new Tile();
t.setPos (i, j);
row.Add (t);
}
floor.Add (row);
}
}