public void DepartFromTile(UrbTile Tile, UrbAgent Agent) { int Xoffset = 0; int Yoffset = 0; if (X == 1 && Y == 1) { UnprintAtTile(Print[0][0], Tile, Agent); s_ArriveAtTile_p.End(); return; } if (X > 2 && Y > 2) { Vector2 Voffset = GetOffset(); Xoffset = (int)Voffset.x; Yoffset = (int)Voffset.y; } for (int y = 0; y < Print.Length; y++) { for (int x = 0; x < Print[y].Length; x++) { UrbTile FillingTile = Tile.GetRelativeTile(x + Xoffset, y + Yoffset); if (FillingTile == null) { continue; } UrbTileprintFill Fill = Print[y][x]; UnprintAtTile(Fill, FillingTile, Agent); } } }
public UrbTile[] GetAllPrintTiles(UrbTile Tile) { int Xoffset = 0; int Yoffset = 0; if (X > 2 && Y > 2) { Vector2 Voffset = GetOffset(); Xoffset = (int)Voffset.x; Yoffset = (int)Voffset.y; } else { return(new UrbTile[] { Tile }); } UrbTile[] ReturnTiles = new UrbTile[X * Y]; int Index = 0; for (int y = 0; y < Print.Length; y++) { for (int x = 0; x < Print[y].Length; x++) { UrbTile CheckedTile = Tile.GetRelativeTile(x + Xoffset, y + Yoffset); ReturnTiles[Index] = CheckedTile; Index++; } } return(ReturnTiles); }
public bool TilePrintCollisionCheck(UrbTile Tile) { int Xoffset = 0; int Yoffset = 0; if (X > 2 && Y > 2) { Vector2 Voffset = GetOffset(); Xoffset = (int)Voffset.x; Yoffset = (int)Voffset.y; } for (int y = 0; y < Print.Length; y++) { for (int x = 0; x < Print[y].Length; x++) { UrbTile CheckedTile = Tile.GetRelativeTile(x + Xoffset, y + Yoffset); if (CheckedTile == null) { return(true); } UrbTileprintFill Fill = Print[y][x]; switch (Fill) { case UrbTileprintFill.Block: case UrbTileprintFill.Occupy: if (CheckedTile.Blocked) { return(true); } break; default: break; } } } return(false); }
public UrbTile[] GetBorderingTiles(UrbTile Tile, bool GetLinked = false, int Distance = 0) { if (X < 2 && Y < 2 && Distance == 0) { return(Tile.GetAdjacent(GetLinked)); } Vector2 Voffset = GetOffset(); int Xoffset = (int)Voffset.x; int Yoffset = (int)Voffset.y; List <UrbTile> ReturnList = new List <UrbTile>(); for (int i = -1; i <= X; i++) { UrbTile CheckedTile = Tile.GetRelativeTile(i + Xoffset, Yoffset - (1 + Distance)); if (CheckedTile == null) { continue; } ReturnList.Add(CheckedTile); } for (int i = 0; i <= Y; i++) { UrbTile CheckedTile = Tile.GetRelativeTile(X + Xoffset + Distance, i + Yoffset); if (CheckedTile == null) { continue; } ReturnList.Add(CheckedTile); } for (int i = -1; i <= X; i++) { UrbTile CheckedTile = Tile.GetRelativeTile(i + Xoffset, Y + Yoffset + Distance); if (CheckedTile == null) { continue; } ReturnList.Add(CheckedTile); } for (int i = 0; i < Y; i++) { UrbTile CheckedTile = Tile.GetRelativeTile(Xoffset - (1 + Distance), Yoffset + i); if (CheckedTile == null) { continue; } ReturnList.Add(CheckedTile); } if (GetLinked) { UrbTile[] Tiles = GetAllPrintTiles(Tile); foreach (UrbTile PrintTile in Tiles) { if (PrintTile != null) { ReturnList.AddRange(PrintTile.GetLinked()); } } } return(ReturnList.ToArray()); }