示例#1
0
        private void updateText()
        {
            var pos = selector.position;

            text.text = "[" + pos.x + ",  " + pos.y + ",  " + pos.z + "]" + "\n"
                        + map.blockType.getEnumValue(pos).NAME + " " + MaterialMap.get().material(map.blockType.getMaterial(pos)).name;
        }
        private void createLayerGroup(string tag, int totalThickness, string type)
        {
            List <Material_> materials = MaterialMap.get().getByTag(tag);
            int singleLayerThickness   = totalThickness / materials.Count;

            materials.ForEach(material => layers.Add(generateLayer(material.name, singleLayerThickness - 1, singleLayerThickness + 1)));
            Debug.Log(type + " stone layers created, total: " + totalThickness + ", single: " + singleLayerThickness);
        }
示例#3
0
        private void updateText()
        {
            if (cacheTarget == modelPosition)
            {
                return;
            }
            var pos = modelPosition;

            if (!map.inMap(pos))
            {
                return;
            }
            text.text = "[" + pos.x + ",  " + pos.y + ",  " + pos.z + "]" + "\n"
                        + map.blockType.getEnumValue(pos).NAME + " " + MaterialMap.get().material(map.blockType.getMaterial(pos)).name;
            cacheTarget = modelPosition;
        }
示例#4
0
        public EcsEntity generateItem(string typeName, string materialName, Vector3Int position, EcsEntity entity)
        {
            ItemType type = ItemTypeMap.getItemType(typeName);

            if (type == null)
            {
                Debug.LogError("Type " + typeName + " not found.");
            }
            Material_ material = MaterialMap.get().material(materialName);

            entity.Replace(new ItemComponent {
                material = material.id, type = typeName, materialString = material.name, volume = 1, weight = material.density * 1
            });
            entity.Replace(new PositionComponent {
                position = position
            });
            entity.Replace(new NameComponent());
            // entity.Replace(new ItemVisualComponent());
            return(entity);
        }
示例#5
0
        public void loadAll()
        {
            SpriteAtlas      atlas     = Resources.Load <SpriteAtlas>("tilesets/local_blocks/blockSpriteAtlas");
            List <Material_> materials = MaterialMap.get().all;

            foreach (Material_ material in materials)
            {
                if (material.tileset != null)
                {
                    Sprite sprite = getSprite(atlas, material);
                    Dictionary <string, Tile> tileset = loader.slice(sprite);
                    tileset.Values.ToList().ForEach(tile => tile.color = material.color); // update tile colors
                    tilesets.Add(material.name, tileset);
                }
            }
            Sprite selection = atlas.GetSprite("selection");
            Dictionary <string, Tile> tileset2 = loader.slice(selection);

            tilesets.Add("selection", tileset2);
            flushNotFound();
        }
示例#6
0
 public void setRaw(int x, int y, int z, int value, string material) => setRaw(x, y, z, value, MaterialMap.get().id(material));
 private string selectMaterial(int x, int y, int z)
 {
     return(MaterialMap.get().material(map.blockType.material[x, y, z]).name);
 }