GetLeftBorder() публичный статический Метод

public static GetLeftBorder ( float x ) : int
x float
Результат int
Пример #1
0
    private ICollection <Vec2> GetPotentialTiles(Vec2 point, Vector2 normal)
    {
        List <Vec2> tiles = new List <Vec2> ();

        for (int i = 1; i <= extra; i++)
        {
            Vector2 newPoint = new Vector2(point.x, point.y) + normal * i;
            tiles.Add(new Vec2(MapUtil.GetLeftBorder(newPoint.x), MapUtil.GetLowerBorder(newPoint.y)));
        }

        return(tiles);
    }
Пример #2
0
    public ICollection <Vec2> GetTilesToLoad(float x, float y, float w, float h, int m, int n)
    {
        List <Vec2> tiles = new List <Vec2> ();

        //clamp the position
        int left  = MapUtil.GetLeftBorder(Mathf.Clamp(x, 0, w));
        int lower = MapUtil.GetLowerBorder(Mathf.Clamp(y, 0, h));
        int right = MapUtil.GetRightBorder(Mathf.Clamp(w, x, m));
        int upper = MapUtil.GetUpperBorder(Mathf.Clamp(h, y, n));

        for (int i = left; i < right; i++)
        {
            for (int j = lower; j < upper; j++)
            {
                tiles.Add(new Vec2(i, j));
            }
        }

        return(tiles);
    }