Example #1
0
    public GemStone AddGemstone(int rowIndex, int columIndex)
    {
        GemStone c = Instantiate(gemstone) as GemStone;

        c.transform.parent = this.transform;
        c.GetComponent <GemStone> ().RandomCreateGemstoneBg();
        c.GetComponent <GemStone> ().UpdatePosition(rowIndex, columIndex);
        return(c);
    }
Example #2
0
    private GameObject BuildHighLvGemObj(int level, GemMeshType meshType, GemDecalType decalType, int colID)
    {
        GameObject gem;

        if (cfg.isColDependParticle)
        {
            gem = GameObject.Instantiate(cfg.PrefabInstances_Particle[(level - 3) * 5 + colID + 2]);
        }
        else
        {
            gem = GameObject.Instantiate(cfg.PrefabInstances[level - 1]);
        }
        string DecalType = decalType == GemDecalType.NULL? "_NoDecal" : "_Decal" + (int)decalType;

        gem.name = "Gem_Lv" + level + "_" + meshType.ToString() + "_" + colID + DecalType;
        GemStone stone = gem.transform.GetChild(0).FindChild("GemObj").gameObject.AddComponent <GemStone>();

        stone.meshType = meshType;
        stone.GetComponent <MeshFilter>().mesh = cfg.GemMeshes[(int)meshType];
        stone.level = level;
        if (stone.Material == null)
        {
            //Material tempM = DrawMaterialList(_stone.material, cfg.GetTempMaterialList());
            Material tempM = cfg.ChooseTheMat(stone.level, stone.meshType);
            AssetDatabase.CreateAsset(tempM, cfg.materialsPath + "/Mat_Lv" + level + "_" + meshType.ToString() + "_" + colID + DecalType + ".mat");
            stone.Material = tempM;
            stone.Material = AssetField <Material>("Material", stone.Material);
            generatedMats.Add(cfg.materialsPath + "/Mat_Lv" + level + "_" + meshType.ToString() + "_" + colID + DecalType + ".mat");
        }
        if (stone.meshType == GemMeshType.Oval || stone.meshType == GemMeshType.Sphere)
        {
            stone.GemColor  = cfg.Colors[colID];
            stone.decalType = decalType;
            if (decalType != GemDecalType.NULL)
            {
                stone.DecalColor = cfg.DecalColors[colID];
                stone.DecalTex   = cfg.AdditiveTexs[(int)decalType];
                stone.BumpMap    = cfg.AdditiveNormalTexs[(int)decalType];
            }
            else
            {
                stone.DecalColor = new Color(0, 0, 0, 0);
            }
            stone.MainTex = cfg.BaseTexs[(level - 1) * 5 + colID];
        }
        gem.transform.SetParent(GemsManager.transform);

        //计算位置:
        gem.transform.localPosition = GetTheGemPos(level - 1, meshType, decalType, colID);
        gemMatID++;
        return(gem);
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        gemStoneList = new ArrayList();

        for (int row = 0; row < rowNum; row++)
        {
            ArrayList temp = new ArrayList();
            for (int col = 0; col < rowNum; row++)
            {
                GemStone c = Instantiate(gemStone) as GemStone;
                c.transform.parent = this.transform;
                temp.Add(c);
                c.GetComponent <GemStone>().UpdatePosition(row, col);
            }
            gemStoneList.Add(temp);
        }
    }