Пример #1
0
    public Coord makeRangeSafe(CoRange _coRa)
    {
        Coord retCo      = Coord.Max(this, _coRa.start);
        Coord outerMinus = _coRa.outerLimit() - 1;

        return(Coord.Min(this, outerMinus));
    }
Пример #2
0
    public List <Chunk> chunksInCoRange(CoRange _corange, bool excludeNullChunks)
    {
        List <Chunk> retChunks = new List <Chunk> ();

        if (!chunks.ContainsKey(_corange.start))
        {
            return(retChunks);
        }

        Coord start = _corange.start;
        Coord range = _corange.range;
        int   i     = start.x;

        for (; i < start.x + range.x; ++i)
        {
            int j = (int)start.y;
            for (; j < start.y + range.y; ++j)
            {
                int k = start.z;
                for (; k < start.z + range.z; ++k)
                {
                    Chunk chh = chunkAt(i, j, k);
                    if (!excludeNullChunks || (chh != null))
                    {
                        retChunks.Add(chh);
                    }
                }
            }
        }
        return(retChunks);
    }
Пример #3
0
    public CoRange makeRangeSafeCoRange(CoRange mapDims)
    {
        CoRange retCo = this;

        retCo.start = Coord.Max(retCo.start, mapDims.start);
        retCo.range = Coord.Min(retCo.range, mapDims.range);
        return(retCo);
    }
Пример #4
0
    public bool isInsideOfRange(CoRange coRange)
    {
        Coord outerLimit = coRange.outerLimit();

        return((Coord.greaterThanOrEqual(this, coRange.start)) && (Coord.greaterThan(outerLimit, this)));


        //		return this.isInsideOfRange (coRange.start, coRange.range);
    }
Пример #5
0
    static void drawDebugCube(CoRange chunkCoRange, bool drawBlock)
    {
        int   length = drawBlock ? 1 : (int)ChunkManager.CHUNKLENGTH;
        Coord start  = chunkCoRange.start * length;

        if (drawBlock)
        {
            drawDebugBlock(start, chunkCoRange.range * length);
            return;
        }

        drawDebugCube(start, chunkCoRange.range * length);
    }
Пример #6
0
 public static Quad QuadFromCoRange(CoRange coRange)
 {
     return(new Quad(PTwo.PTwoXZFromCoord(coRange.start), PTwo.PTwoXZFromCoord(coRange.range)));
 }
Пример #7
0
 public static void drawDebugLinesForChunkRange(CoRange chunkCoRange)
 {
     drawDebugCube(chunkCoRange, false);
 }
Пример #8
0
    public static void drawDebugLinesForBlockAtWorldCoord(Coord woco)
    {
        CoRange blockCo = new CoRange(woco, Coord.coordOne());

        drawDebugCube(blockCo, true);
    }
Пример #9
0
 public List <Chunk> nonNullChunksInCoRange(CoRange _corange)
 {
     return(chunksInCoRange(_corange, true));
 }
Пример #10
0
    public bool isInsideOfRangeInclusive(CoRange coRange)
    {
        Coord outerLimit = coRange.outerLimit();

        return((Coord.greaterThanOrEqual(this, coRange.start)) && (Coord.greaterThanOrEqual(outerLimit, this)));
    }
Пример #11
0
    public static bool Contains(CoRange container, CoRange contained)
    {
        bool startIsLess = Coord.greaterThanOrEqual(contained.start, container.start);

        return(Coord.greaterThan(container.outerLimit(), contained.outerLimit()));
    }