Beispiel #1
0
    public List<ZPoint> Ray(ZPoint position, ZPoint.Direction d, int range, bool penetration)
    {
        List<ZPoint> result = new List<ZPoint>();
        ZPoint p = position + d;
        result.Add(position);

        while ((IsFlat(p) || (penetration && Get(p) != null)) && MyMath.ManhattanDistance(p, position) <= range)
        {
            result.Add(p);
            p += d;
        }

        if (!p.TheSameAs(position)) result.Add(p);
        return result;
    }
Beispiel #2
0
    private void AddToFrontier(List<FramedZPoint> list, ZPoint zPoint, ZPoint.Direction d, ZPoint start, LocalObject t = null)
    {
        if (!IsWalkable(zPoint, t) && !zPoint.TheSameAs(start)) return;

        FramedZPoint item = new FramedZPoint(zPoint, d, true);
        var query = from p in list where p.data.TheSameAs(zPoint) select p;
        if (query.Count() == 0) list.Add(item);
    }