本文整理汇总了C#中Room.GetCentre方法的典型用法代码示例。如果您正苦于以下问题:C# Room.GetCentre方法的具体用法?C# Room.GetCentre怎么用?C# Room.GetCentre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room.GetCentre方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveAway
public void MoveAway(Room otherRoom)
{
Vector2 vectorBetween = this.GetCentre () - otherRoom.GetCentre ();
int moveX = System.Math.Sign (vectorBetween.x);
int moveY = System.Math.Sign (vectorBetween.y);
if (moveX == 0 && moveY == 0){
moveX = Random.Range (-1, 1);
moveY = Random.Range (-1, 1);
}
UpdateLocations (this.originX + moveX, this.originY + moveY);
}
示例2: Connect
private void Connect(Room r1, Room r2)
{
GameObject hall = GameObject.Instantiate (room) as GameObject;
hall.transform.parent = this.transform;
halls.Add (hall.GetComponent<Room>());
hall.GetComponent<Room>().CreateHallway ((int)r1.GetCentre().x,
(int)r1.GetCentre().y,
(int)r2.GetCentre().x,
(int)r2.GetCentre().y);
}