public CheckObstructions ( Vector2f &position, Line line ) : bool | ||
position | Vector2f | |
line | Line | |
리턴 | bool |
public bool CheckObstructions(ref Vector2f position, Line line)
{
Line[] baselines = _innerSS.GetLineBase();
Vector2f pos = position - new Vector2f(_base.Left, _base.Top);
foreach (Line b in baselines)
{
var baseline = b.Offset(pos);
if (Line.Intersects(baseline, line))
return true;
}
return false;
}
Person::CheckObstructions ( Vector2f &pos, |
|
Person::CheckObstructions ( Vector2f &pos, Vector2f &tileOffset, |
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; }