Example #1
0
    void deleteChunks(WorldPos curChunk)
    {
        //the list that will gather chunks to be deleted
        List <WorldPos> chunksToDelete = new List <WorldPos>();

        foreach (WorldPos pos in requestedChunks)
        {
            //NOTE: make 100 a definied variable later and change it to not 100
            //if the distance between the current chunk and one chunk still in the requestedchunks list is greater than an arbitrary value, request its destruction
            if (Vector3.Distance(curChunk.toVector3(), pos.toVector3()) > 120)
            {
                chunksToDelete.Add(pos);
            }
        }

        //now deleta all the chunks that were added to the list
        foreach (WorldPos pos in chunksToDelete)
        {
            requestedChunks.Remove(pos);
            //convert the worldpos to a surface pos
            SurfacePos surfp = UnitConverter.getSP(pos.toVector3(), UniverseSystem.curPlanet.surface.sideLength);

            //convert the surfacepos to a surface unit then request its deletion
            UniverseSystem.curPlanet.surface.deleteSurface(surfp.toUnit());
        }
    }
Example #2
0
    //this requests the generation of a surface unit that is at the center of the chunk
    void requestSurface(WorldPos pos)
    {
        //convert the worldpos to a surface pos
        SurfacePos surfp = UnitConverter.getSP(pos.toVector3(), UniverseSystem.curPlanet.surface.sideLength);

        //Debug.Log (pos);
        //convert the surfacepos to a surface unit then request its creation
        UniverseSystem.curPlanet.surface.CreateSurfaceObjects(surfp.toUnit());
    }
Example #3
0
    //builds the surface units from a chunk
    void buildSurfFromChunk(WorldPos chunk)
    {
        //convert the worldpos to a surface pos
        SurfacePos surfp = UnitConverter.getSP(chunk.toVector3(), UniverseSystem.curPlanet.surface.sideLength);

        //convert the surfacepos to a surface unit then request its creation
        UniverseSystem.curPlanet.surface.CreateSurfaceObjects(surfp.toUnit());
        requestedChunks.Add(chunk);        //add it to the already requested chunks list
    }