void RemoveMatches() //NOTE: HERE can get how many chain the match gets //how many match we get? //Debug.Log("Match NUM: " + matchesGemstone.Count); { Gemstone sample = matchesGemstone [0] as Gemstone; GemstoneType t = sample.gemstoneType; ///// //Modify container!! if (matchesGemstone.Count >= 4) { Debug.Log("REMOVE MATCHES " + matchesGemstone.Count); //Debug.Log (t.ToString()); priorSpawnInfo.Add(t); //Debug.Log ("in the list:" + priorSpawnInfo [0].ToString ()); } for (int i = 0; i < matchesGemstone.Count; i++) { Gemstone c = matchesGemstone[i] as Gemstone; //Debug.Log ("TYPE" + c.gemstoneType); RemoveGemstone(c); } matchesGemstone = new ArrayList(); StartCoroutine(WaitForCheckMatchesAgain()); }
public Gemstone AddUpgradedGemstone(int rowIndex, int columIndex, int chain, GemstoneType t) //add corresponding upgraded gemstone when match 4+ { Gemstone c = Instantiate(gemstone) as Gemstone; c.transform.parent = this.transform; //生成宝石为GameController子物体 //Debug.Log("AddUpgradedGemstone() received type: " + t.ToString()); c.GetComponent <Gemstone>().CreateUpgradedGemstone(chain, t); c.GetComponent <Gemstone>().UpdatePosition(rowIndex, columIndex); return(c); }
public String GetImagePath(GemstoneType gtype) { switch (gtype) { case GemstoneType.红宝石: return("/res/icons/item/d0.png"); case GemstoneType.蓝宝石: return("/res/icons/item/d1.png"); case GemstoneType.绿宝石: return("/res/icons/item/d2.png"); case GemstoneType.铁剑: return("/res/icons/equipment/a0.png"); case GemstoneType.铁盾: return("/res/icons/equipment/a8.png"); case GemstoneType.银剑: return("/res/icons/equipment/a1.png"); case GemstoneType.银盾: return("/res/icons/equipment/a9.png"); case GemstoneType.骑士剑: return("/res/icons/equipment/a2.png"); case GemstoneType.骑士盾: return("/res/icons/equipment/a10.png"); case GemstoneType.圣剑: return("/res/icons/equipment/a3.png"); case GemstoneType.圣盾: return("/res/icons/equipment/a11.png"); case GemstoneType.红血瓶: return("/res/icons/item/b0.png"); case GemstoneType.蓝血瓶: return("/res/icons/item/b1.png"); case GemstoneType.绿血瓶: return("/res/icons/item/b2.png"); case GemstoneType.黄血瓶: return("/res/icons/item/b3.png"); } return(null); }
public void DestroyAGemType(GemstoneType t) { for (int i = 0; i < rowNum; i++) { for (int j = 0; j < columNum; j++) { Gemstone gem = GetGemstone(i, j); if (gem.gemstoneType == t) { AddMatches(gem); } } } Debug.Log(matchesGemstone.Count); RemoveMatches(); }
/// <summary> /// //NOTE: /// When create Gemstones, as you instantiate the gemstones, don't forget to get the type from the gemstoneBg (the prefab which has sprite renderer), and assign it to the type in this script!!!! /// </summary> public void RandomCreateGemstoneBg() //随机的宝石类型 , special gems NOT included { if (gemstoneBg != null) { return; } //generate a random index int randomIndex = Random.Range(0, gemstoneBgs.Count()); //from the regular pool, generate a random gemstone gemstoneBg = Instantiate(gemstoneBgs [randomIndex]) as GameObject; //assign the gemstone type on this script gemstoneType = gemstoneBg.GetComponent <GemType> ().type; gemstoneBg.transform.parent = this.transform; }
public void CreateUpgradedGemstone(int chain, GemstoneType t) //create special gemstone { if (gemstoneBg != null) { return; } //loop through the special pool, fide the gemstone contains the right type, return it, and spawn it GameObject compare; //int targetIndex; // check chain so we can spawn different tiers if (chain >= 4) { for (int i = 0; i < upgradedPool_level_2.Count; i++) //in the upgraded gem pool, look for the type given { compare = upgradedPool_level_2[i] as GameObject; if (compare.GetComponent <GemType> ().type == t) { targetIndex = upgradedPool_level_2.IndexOf(compare); break; } } } //NOTICE! //if compare is null, targetIndex will result in 0, which will result the spawned gem is always the first one in the list!!!! gemstoneBg = Instantiate(upgradedPool_level_2[targetIndex]) as GameObject; gemstoneType = gemstoneBg.GetComponent <GemType> ().type; gemstoneBg.transform.parent = this.transform; }
public GemstoneImage(GemstoneType type) : base() { SetImageSource(GetImagePath(type)); coarseType = Atype.宝石; fineType = type; }