public CheckObstructions ( Vector2f &position, Line line ) : bool | ||
position | Vector2f | |
line | Line | |
Résultat | bool |
public static bool CheckTileObstruction(ref Vector2f position, Person person) { int tw = _map.Tileset.TileWidth, th = _map.Tileset.TileHeight; int sx = (int)position.X / tw + 2; int sy = (int)position.Y / th + 2; Vector2f pos = new Vector2f(); for (var y = sy - 2; y < sy; ++y) { pos.Y = y * th; for (var x = sx - 2; x < sx; ++x) { pos.X = x * tw; int t = _map.Layers[person.Layer].GetTile(x, y); if (t >= 0 && person.CheckObstructions(ref position, ref pos, _map.Tileset.Tiles[t])) return true; } } return false; }
public static bool CheckPersonObstructions(ref Vector2f position, Person person) { foreach (Person p in People) { if (p.Layer == person.Layer && p.Name != person.Name && person.CheckObstructions(ref position, p)) { ObstPerson = p.Name; return true; } } return false; }
public static bool CheckLineObstruction(ref Vector2f position, Person person) { foreach (Segment s in _map.Layers[person.Layer].Segments) { if (person.CheckObstructions(ref position, s.Line)) return true; } return false; }