本文整理汇总了C#中Coord.Distance方法的典型用法代码示例。如果您正苦于以下问题:C# Coord.Distance方法的具体用法?C# Coord.Distance怎么用?C# Coord.Distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coord
的用法示例。
在下文中一共展示了Coord.Distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPlayerAndCreatures
private void AddPlayerAndCreatures()
{
Room mainRoom = rooms[rooms.Count - 1];
playerLoc = mainRoom.tiles[rand.Next(0, mainRoom.tiles.Count)];
map[playerLoc.tileX, playerLoc.tileY] = 2;
manager.movingObjects[playerLoc.tileX, playerLoc.tileY] = true;
player.transform.position = new Vector3(playerLoc.tileX, playerLoc.tileY, 0f);
GameObject instance;
for(int i = 0; i < rooms.Count - 1; i++)
{
for(int j = 0; j < (rooms[i].roomSize / rand.Next(15, 25)); j++ )
{
Coord tilePlacement = rooms[i].tiles[rand.Next(0, rooms[i].tiles.Count)];
if (map[tilePlacement.tileX, tilePlacement.tileY] > 1 || playerLoc.Distance(tilePlacement) < 10)
continue;
instance = EnemyFactory.GetRandomObject(new Vector3(tilePlacement.tileX, tilePlacement.tileY, 0f), Quaternion.identity);
instance.transform.SetParent(levelHolder);
map[tilePlacement.tileX, tilePlacement.tileY] = 3;
manager.movingObjects[tilePlacement.tileX, tilePlacement.tileY] = true;
}
}
}