本文整理汇总了C#中Room.GetX方法的典型用法代码示例。如果您正苦于以下问题:C# Room.GetX方法的具体用法?C# Room.GetX怎么用?C# Room.GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room.GetX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRoom
public void AddRoom(Room room)
{
Rooms.Add (room);
int x = room.GetX ();
int y = room.GetY ();
int w = room.GetWidth ();
int h = room.GetHeight ();
for (int i = y; i < y+h; i++) {
for(int j = x; j < x+w; j++) tiles[i, j] = true;
}
}
示例2: MarkRoom
private void MarkRoom(Room r, int newstate)
{
for (int i = r.GetX(); i < r.GetX() + r.GetWidth(); i++) {
for(int j = r.GetY(); j < r.GetY() + r.GetHeight(); j++) {
tiles[j, i] = newstate;
}
}
}
示例3: IsInside
public bool IsInside(Room r, Vertex2 point)
{
int rx = r.GetX ();
int ry = r.GetY ();
int rw = r.GetWidth ();
int rh = r.GetHeight ();
bool isx = point.x >= rx && point.x <= rx + rw;
bool isy = point.y >= ry && point.y < ry + rh;
return isx && isy;
}
示例4: Overlaps
public bool Overlaps(Room room, int buffer)
{
bool overlaps = false;
foreach (Room other in Rooms) {
bool overlapsX = room.GetX() < other.GetX() + other.GetWidth() + buffer
&& room.GetX() + room.GetWidth() + buffer > other.GetX();
bool overlapsY = room.GetY() < other.GetY() + other.GetHeight() + buffer
&& room.GetY() + room.GetHeight() + buffer > other.GetY();
if(!overlaps) overlaps = overlapsX && overlapsY;
}
return overlaps;
}