public int mIndex; //糖果索引 public SCandy(int pCol, int pRow, _TYPE pType, int pIndex) { this.mCol = pCol; this.mRow = pRow; this.mType = pType; this.mIndex = pIndex; }
public cHitResult( _TYPE type , int ident , int value1 =0,int value2=0,int value3=0,int value4=0 ) { eHitType = type; Ident = ident; Value1 = value1; Value2 = value2; Value3 = value3; Value3 = value4; }
//重复使用已有的游戏对象 private Candy reuseCandy(_TYPE pType, int pIndex) { Candy result = null; result = RecycleList.Find((x) => (x.mType == pType && x.mIndex == pIndex)); if (null != result) { RecycleList.Remove(result); } return(result); }
//新建糖果 private Candy NewCandy(int col, int row, Vector3 sPos, _TYPE ptype, int type_Index) { Candy ca = this.reuseCandy(ptype, type_Index); if (null == ca) { // GameObject go = Instantiate(T) as GameObject; // Sprite sprite = this.getSpecialSprite(ptype, type_Index); // SpriteRenderer sr = go.GetComponent <SpriteRenderer>(); sr.sprite = sprite; // if (null != go) { go.transform.parent = this.transform; go.transform.position = sPos; ca = go.GetComponent(typeof(Candy)) as Candy; ca.mIndex = type_Index; ca.mType = ptype; ca.isSpecial = (!(ptype == _TYPE.NORMAL)); ca.mPos = new Vector3(BVector.x + col * xOff, BVector.y + row * yOff, 0); ca.mRow = row; ca.mCol = col; ca.AttachEventCallback(ac.ExchangeEventCallback); } } else { ca.gameObject.SetActive(true); ca.gameObject.transform.position = sPos; ca.isSpecial = (!(ptype == _TYPE.NORMAL)); ca.mPos = new Vector3(BVector.x + col * xOff, BVector.y + row * yOff, 0); ca.mRow = row; ca.mCol = col; ca.setDark(false); ca.setChosen(false); } // return(ca); }
// private Sprite getSpecialSprite(_TYPE ptype, int index) { Sprite result = null; switch (ptype) { case _TYPE.NORMAL: { result = this.normalCandys[index]; break; } case _TYPE.STREAKH: { result = streakHCandys[index]; break; } case _TYPE.STREAKV: { result = streakVCandys[index]; break; } case _TYPE.PACKAGE: { result = packageCandys[index]; break; } case _TYPE.COLORFUL: { result = colorfulCandys[index]; break; } default: break; } return(result); }
//重复使用已有的游戏对象 private Candy reuseCandy(_TYPE pType, int pIndex) { Candy result = null; result = RecycleList.Find((x) => (x.mType == pType && x.mIndex == pIndex)); if (null != result) { RecycleList.Remove(result); } return result; }
//新建糖果 private Candy NewCandy(int col, int row, Vector3 sPos, _TYPE ptype, int type_Index) { Candy ca = this.reuseCandy(ptype, type_Index); if (null == ca) { // GameObject go = Instantiate(T) as GameObject; // Sprite sprite = this.getSpecialSprite(ptype, type_Index); // SpriteRenderer sr = go.GetComponent<SpriteRenderer>(); sr.sprite = sprite; // if (null != go) { go.transform.parent = this.transform; go.transform.position = sPos; ca = go.GetComponent(typeof(Candy)) as Candy; ca.mIndex = type_Index; ca.mType = ptype; ca.isSpecial = (!(ptype == _TYPE.NORMAL)); ca.mPos = new Vector3(BVector.x + col * xOff, BVector.y + row * yOff, 0); ca.mRow = row; ca.mCol = col; ca.AttachEventCallback(ac.ExchangeEventCallback); } } else { ca.gameObject.SetActive(true); ca.gameObject.transform.position = sPos; ca.isSpecial = (!(ptype == _TYPE.NORMAL)); ca.mPos = new Vector3(BVector.x + col * xOff, BVector.y + row * yOff, 0); ca.mRow = row; ca.mCol = col; ca.setDark(false); ca.setChosen(false); } // return ca; }
// private Sprite getSpecialSprite(_TYPE ptype, int index) { Sprite result = null; switch (ptype) { case _TYPE.NORMAL: { result = this.normalCandys[index]; break; } case _TYPE.STREAKH: { result = streakHCandys[index]; break; } case _TYPE.STREAKV: { result = streakVCandys[index]; break; } case _TYPE.PACKAGE: { result = packageCandys[index]; break; } case _TYPE.COLORFUL: { result = colorfulCandys[index]; break; } default: break; } return result; }
public _TYPE mType; //糖果类型 #endregion Fields #region Constructors public SCandy(int pCol, int pRow, _TYPE pType, int pIndex) { this.mCol = pCol; this.mRow = pRow; this.mType = pType; this.mIndex = pIndex; }