Exemplo n.º 1
0
    public bool CheckAreaType(PATileTerrain tileTerrain)
    {
        if (closeTile == null)
        {
            return(false);
        }
        if (!CheckCloseTileElementType())
        {
            return(false);
        }
        if (areaType == AreaType.Area1X1)
        {
            return(true);
        }

        PATileTerrain.PATile[] nTiles = tileTerrain.GetNeighboringTilesNxN(closeTile, 1);
        if (areaType == AreaType.Area2X2)
        {
            for (int i = 5; i < nTiles.Length; i++)
            {
                if (!CheckElementType(nTiles[i]))
                {
                    return(false);
                }
            }
        }
        else if (areaType == AreaType.Area3X3)
        {
            for (int i = 0; i < nTiles.Length; i++)
            {
                if (!CheckElementType(nTiles[i]))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
Exemplo n.º 2
0
        //将没有完美融合的qtrtile设置成none
        public bool ProcessMixPerfect(PATileTerrain tileTerrain)
        {
            PATile[] nTiles = tileTerrain.GetNeighboringTilesNxN(this, 1);

            PATile leftBottomTile  = nTiles[0];
            PATile leftTile        = nTiles[1];
            PATile leftTopTile     = nTiles[2];
            PATile topTile         = nTiles[3];
            PATile rightTopTile    = nTiles[4];
            PATile rightTile       = nTiles[5];
            PATile rightBottomTile = nTiles[6];
            PATile bottomTile      = nTiles[7];
            bool   isPerfect       = true;

            QtrTileElementType qte0 = GetQtrTileElementType(bottomTile, 1);
            QtrTileElementType qte1 = GetQtrTileElementType(leftBottomTile, 2);
            QtrTileElementType qte2 = GetQtrTileElementType(leftTile, 3);
            QtrTileElementType qte  = qtrTiles[0];

            if (qte == qte0 && qte == qte1 && qte == qte2)
            {
            }
            else
            {
                isPerfect   = false;
                qtrTiles[0] = QtrTileElementType.None;
            }


            qte0 = GetQtrTileElementType(leftTile, 2);
            qte1 = GetQtrTileElementType(leftTopTile, 3);
            qte2 = GetQtrTileElementType(topTile, 0);
            qte  = qtrTiles[1];
            if (qte == qte0 && qte == qte1 && qte == qte2)
            {
            }
            else
            {
                isPerfect   = false;
                qtrTiles[1] = QtrTileElementType.None;
            }

            qte0 = GetQtrTileElementType(topTile, 3);
            qte1 = GetQtrTileElementType(rightTopTile, 0);
            qte2 = GetQtrTileElementType(rightTile, 1);
            qte  = qtrTiles[2];
            if (qte == qte0 && qte == qte1 && qte == qte2)
            {
            }
            else
            {
                isPerfect   = false;
                qtrTiles[2] = QtrTileElementType.None;
            }

            qte0 = GetQtrTileElementType(rightTile, 0);
            qte1 = GetQtrTileElementType(rightBottomTile, 1);
            qte2 = GetQtrTileElementType(bottomTile, 2);
            qte  = qtrTiles[3];
            if (qte == qte0 && qte == qte1 && qte == qte2)
            {
            }
            else
            {
                isPerfect   = false;
                qtrTiles[3] = QtrTileElementType.None;
            }

            return(isPerfect);
        }
Exemplo n.º 3
0
    void PaintElement(Shuijing shuijing, ref Dictionary <int, PATileTerrain.PATile> collectTiles)
    {
        shuijing.affectTiles.Clear();
        CrystalRangeConfigAsset.CrystalRangeConfig configData = null;
        foreach (var config in ConfigDataBase.instance.CrystalRangeConfigAsset.configs)
        {
            if (config.level == shuijing.level)
            {
                configData = config;
            }
        }

        if (configData == null)
        {
            return;
        }

        float   centerValue = configData.centerValue / 100f;
        float   atten       = configData.atten / 100f;
        int     rang        = 1;
        bool    outOfRange  = false;
        bool    hasValue    = false;
        Vector2 crystalPos  = new Vector2(shuijing.tile.x + 1, shuijing.tile.y + 1);

        CalTileElement(shuijing.tile, crystalPos, centerValue, atten, shuijing.elementType);
        if (!collectTiles.ContainsKey(shuijing.tile.id))
        {
            collectTiles.Add(shuijing.tile.id, shuijing.tile);
        }

        if (!shuijing.affectTiles.ContainsKey(shuijing.tile.id))
        {
            shuijing.affectTiles.Add(shuijing.tile.id, shuijing.tile);
        }
        shuijing.tile.affectShuijing = shuijing;
        while (true)
        {
            outOfRange = true;
            PATileTerrain.PATile[] tiles = tileTerrain.GetNeighboringTilesNxN(shuijing.tile, rang);
            rang += 2;
            foreach (var tile in tiles)
            {
                if (tile == null)
                {
                    continue;
                }
                hasValue = CalTileElement(tile, crystalPos, centerValue, atten, shuijing.elementType);
                if (hasValue)
                {
                    if (!collectTiles.ContainsKey(tile.id))
                    {
                        collectTiles.Add(tile.id, tile);
                    }
                    if (!shuijing.affectTiles.ContainsKey(tile.id))
                    {
                        shuijing.affectTiles.Add(tile.id, tile);
                    }
                    if (tile.affectShuijing == null)
                    {
                        tile.affectShuijing = shuijing;
                    }
                    outOfRange = false;
                }
            }
            if (outOfRange)
            {
                break;
            }
        }
    }