Esempio n. 1
0
    public FrameStructure GetShema(short[,] map, TileInfoStructure info, Vector2Int pos)
    {
        /*if (info.type == 0) {
         *  return FrameStructure.Empty();
         * }*/
        //if (info.IsWater()) {
        if (info.IsWater() || pos.y > MapGenerator.surface[pos.x].y)
        {
            return(FrameStructure.Empty());
        }
        //}

        FrameStructure rez = new FrameStructure(1, 1);

        rez.TileCollection = "LightTiles";


        return(rez);
    }
Esempio n. 2
0
    public FrameStructure GetFrameStructure(float x, float y, TileInfoStructure tileStructure, LayerData layerData)
    {
        FrameStructure rez = FrameStructure.Empty();


        var pos = new Vector2(x, y);

        if (layerData.IsShowWater)
        {
            if (tileStructure.IsWater())
            {
                var rectWater = GetRect(3, pos, 3, layerData);
                rez = SpriteData.Liquid_0.Shema.GetShema(rectWater, tileStructure);
                return(rez);
            }
        }

        if (layerData.IsShowLight)
        {
            var rectLight = GetRectStructure(3, pos, 0);
            rez = LightShema.GetShemaStructure(rectLight, tileStructure);
            return(rez);
        }

        if (tileStructure.type == 0 && tileStructure.typeBG == 0)
        {
            return(rez);
        }

        if (layerData == LayerData.TerrainBgLayer)
        {
            if (tileStructure.typeBG == 0)
            {
                return(rez);
            }


            if (IsAllNeighborsIsNotEmpty(x, y))
            {
                return(rez);
            }



            var rectBg = GetRect(3, pos, 3, layerData);
            rez = SpriteData.Tiles_bg.Shema.GetShema(rectBg, tileStructure);
            rez.TileCollection = SpriteData.Tiles_bg.Name;
            return(rez);
        }

        if (tileStructure.type == 0)
        {
            return(rez);
        }

        if (!layerData.IsContainsTileType(tileStructure.type))
        {
            return(rez);
        }

        var data = SpriteData.SpritesByTypeId[tileStructure.type];
        var rect = GetRect(data.SquareSizeByShema, pos, tileStructure.layer, layerData);

        rez = data.Shema.GetShema(rect, tileStructure);
        rez.TileCollection = data.Name;

        return(rez);
    }