Exemplo n.º 1
0
 void Start()
 {
     firstScreenTouh      = -Vector3.zero;
     firstScreenTouhWheel = -Vector3.zero;
     DATA = GameObject.FindGameObjectWithTag("DATA");
     VMG  = DATA.GetComponent <VoxelMapGenerator>();
 }
Exemplo n.º 2
0
    public static void AddStructureToChunk(ref VoxelMapGenerator _VMG, int structureID, Vector3 spawnPoint)
    {
        _VMG.worldResources.Structures[structureID].BuildPointer = spawnPoint;
        var chunks = Chunk.SetStructure(ref _VMG.worldResources, _VMG.worldResources.Structures[structureID]);

        foreach (var i in chunks)
        {
            i.UpdateChunk();
        }
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        VoxelMapGenerator MapGenerator = (VoxelMapGenerator)target;

        if (GUILayout.Button("Generate Map"))
        {
            MapGenerator.VoxelMapGenerate();
            MapGenerator.ClearIsoGarbage();
        }
    }
Exemplo n.º 4
0
 public Tilemap2D(int sizeX, int sizeY, DataEntity entity) : base(entity)
 {
     tiles = new TileType[sizeX, sizeY];
     VoxelMapGenerator.Generate2DTileMap(tiles, (TileType[])Enum.GetValues(typeof(TileType)));
 }
Exemplo n.º 5
0
    public static void InstantiateBlockToChunk(BlockSelectingType typeOfInstance, byte instantiateBlockId, ref Vector3 globalPointer, ref VoxelMapGenerator _VMG)
    {
        globalPointer = GetPointerPos(globalPointer, typeOfInstance);
        ArrayDimensions pointerInChunckMap = GetCorrectBlockPos(globalPointer);
        Point           chunkIndex         = GetChunkIndexFromPointer(globalPointer, pointerInChunckMap);
        Chunk           selectedChunk      = _VMG.worldResources.WorldMap[chunkIndex.Y, chunkIndex.X];

        selectedChunk.ChunkMap[pointerInChunckMap.Y, pointerInChunckMap.Z, pointerInChunckMap.X] = instantiateBlockId;
        selectedChunk.UpdateChunk();
        TryToUpdateNeighborChuncks(pointerInChunckMap, chunkIndex, ref _VMG);
    }
Exemplo n.º 6
0
    private static void TryToUpdateNeighborChuncks(ArrayDimensions pointer, Point currentChunckIndex, ref VoxelMapGenerator VMG)
    {
        if (pointer.X == 0)
        {
            if (currentChunckIndex.X - 1 >= 0)
            {
                VMG.worldResources.WorldMap[currentChunckIndex.Y, currentChunckIndex.X - 1].UpdateChunk();
            }
        }

        if (pointer.X == 15)
        {
            if (currentChunckIndex.X + 1 < VMG.ChunksRenderDistance)
            {
                VMG.worldResources.WorldMap[currentChunckIndex.Y, currentChunckIndex.X + 1].UpdateChunk();
            }
        }

        if (pointer.Z == 0)
        {
            if (currentChunckIndex.Y - 1 >= 0)
            {
                VMG.worldResources.WorldMap[currentChunckIndex.Y - 1, currentChunckIndex.X].UpdateChunk();
            }
        }

        if (pointer.Z == 15)
        {
            if (currentChunckIndex.Y + 1 < VMG.ChunksRenderDistance)
            {
                VMG.worldResources.WorldMap[currentChunckIndex.Y + 1, currentChunckIndex.X].UpdateChunk();
            }
        }
    }