public Gemstone AddGemstone(int rowIndex, int columIndex, int type) { Gemstone stone = Instantiate(gemstone, transform) as Gemstone;// 生成宝石作为GameController子物体 stone.GetComponent <Gemstone>().CreateGemstoneBg(type); stone.GetComponent <Gemstone>().UpdatePosiImmi(rowIndex, columIndex); return(stone); }
//加入寶石 public Gemstone AddGemstone(int rowIndex, int columnIndex) { Gemstone c = Instantiate(gemstone) as Gemstone; c.transform.parent = this.transform; c.GetComponent <Gemstone>().RandomCreateGemstoneBg(); c.GetComponent <Gemstone>().UpdatePosition(rowIndex, columnIndex); return(c); }
public Gemstone AddRegularGemstone(int rowIndex, int columIndex) //生成宝石 { Gemstone c = Instantiate(gemstone) as Gemstone; c.transform.parent = this.transform; //生成宝石为GameController子物体 c.GetComponent <Gemstone>().RandomCreateGemstoneBg(); c.GetComponent <Gemstone>().UpdatePosition(rowIndex, columIndex); return(c); }
public Gemstone CreateGemstone(int rowindex, int colindex) { Gemstone c = Instantiate(gemstone) as Gemstone; c.transform.parent = this.transform; c.GetComponent <Gemstone>().CreateRandomGemstone(); c.GetComponent <Gemstone>().UpdatePosition(rowindex, colindex); return(c); }
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); }
private IEnumerator ClearWithAnimation(Gemstone c) { //播放清除动画 Animator animator = c.GetComponent <Animator>(); if (animator != null) { animator.Play(clear.name); yield return(new WaitForSeconds(clear.length)); int type = c.gemstoneType; ++array[type]; if (type == 0) { scoreText[0].text = (LIFE_LENGTH - array[0]).ToString(); } else { scoreText[type].text = array[type].ToString(); } RemoveGemstone(c); //每删除一个宝石加10分 GameManager.score += 10; } }
// Use this for initialization void Start() { gemstoneList = new ArrayList(); for (int rowIndex = 0; rowIndex < rownum; rowIndex++) { ArrayList temp = new ArrayList(); for (int colIndex = 0; colIndex < colnum; colIndex++) { Gemstone c = Instantiate(gemstone) as Gemstone; c.transform.parent = this.transform; temp.Add(c); c.GetComponent <Gemstone> ().UpdatePosition(rowIndex, colIndex); } gemstoneList.Add(temp); } }