private GameObject CreatePattern(HexaPattern.Type eType, int nIndex, ColorType eColor, Color colorUI, bool bIsSpecial) { GameObject gameObject = Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/HexaPattern")); gameObject.transform.SetParent(this.panelPattern); // this._panelPattern); gameObject.transform.localScale = Vector3.zero; gameObject.transform.position = listPosPattern[nIndex].position; if (bIsSpecial) { //gameObject.transform.position = this._specialPatternManager.transform.position; } else { gameObject.transform.localPosition = new Vector2(0f, 0f); } HexaPattern pattern = gameObject.GetComponent <HexaPattern>(); if (pattern != null) { pattern.Init(); pattern.CreatePattern(nIndex, eType, eColor, colorUI); this.listPattern.Add(pattern); } return(gameObject); }
private GameObject InitDataPattern(int nIndex, bool bIsSpecial) { ColorType colorType = (!bIsSpecial) ? this.GetRandomColor() : ColorType.SPECIAL_COLOR; HexaPattern.Type eType = (HexaPattern.Type)((!bIsSpecial) ? UnityEngine.Random.Range(0, 6) : 6); Color colorUI = (!bIsSpecial) ? this._listColorUI[(int)colorType] : Color.white; GameObject gameObject = this.CreatePattern(eType, nIndex, colorType, colorUI, bIsSpecial); gameObject.transform.localScale = Vector3.zero; gameObject.transform.DOScale(Vector3.one, 0.25f); gameObject.transform.position = listPosPattern[nIndex].position; gameObject.name = "Pattern " + nIndex;// + this._nCountPattern; gameObject.SetActive(true); //this._nCountPattern++; return(gameObject); }
public List <PosMap> CheckHexa(List <CellModel> listHint, CellModel[,] mapData, HexaPattern.Type eType) { List <PosMap> list = new List <PosMap>(); int count = listHint.Count; if (count == 0 || eType == HexaPattern.Type.SPECIAL) { return(list); } this._mapData = mapData; for (int i = 0; i < count; i++) { PosMap posInMap = listHint[i].PosInMap; CellType type = listHint[i].Type; if (type != CellType.UP) { if (type == CellType.DOWN) { List <PosMap> listTemp = this.CheckCellDown_1(posInMap, listHint[i].Color); this.SumaryListCheckHexa(list, listTemp); listTemp = this.CheckCellDown_2(posInMap, listHint[i].Color); this.SumaryListCheckHexa(list, listTemp); listTemp = this.CheckCellDown_3(posInMap, listHint[i].Color); this.SumaryListCheckHexa(list, listTemp); } } else { List <PosMap> listTemp = this.CheckCellUp_1(posInMap, listHint[i].Color); this.SumaryListCheckHexa(list, listTemp); listTemp = this.CheckCellUp_2(posInMap, listHint[i].Color); this.SumaryListCheckHexa(list, listTemp); listTemp = this.CheckCellUp_3(posInMap, listHint[i].Color); this.SumaryListCheckHexa(list, listTemp); } } return(list); }