void Start() { RangeI = 5; RangeJ = 5; CurrentMiniFieldIndexI = RangeI - 1; MiniFieldMap = new MiniField[RangeI, RangeJ]; Data = new FieldData(Stage); PrevPos = new Vector2(); if (GenerateField == true) { for (int i = 0; i < RangeI; i++) { for (int j = 0; j < RangeJ; j++) { int[,] dataMap = Data.GetPartialMap(RangeI - i - 1, j); if (dataMap == null) { continue; } MiniFieldMap[i, j] = Instantiate(MField) as MiniField; MiniFieldMap[i, j].name = "minifield_" + i + "_" + j; MiniFieldMap[i, j].SetMainField(this); MiniFieldMap[i, j].SetStartPosition(new Vector2(j * 5 * TileInterval, i * 5 * TileInterval)); MiniFieldMap[i, j].SetInterval(TileInterval); MiniFieldMap[i, j].SetMap(dataMap); MiniFieldMap[i, j].Init(); MiniFieldMap[i, j].transform.SetParent(transform); } } } else { for (int i = 0; i < RangeI; i++) { for (int j = 0; j < RangeJ; j++) { int[,] dataMap = Data.GetPartialMap(RangeI - i - 1, j); if (dataMap == null) { continue; } MiniFieldMap[i, j] = GameObject.Find("minifield_" + i + "_" + j).GetComponent <MiniField>(); MiniFieldMap[i, j].SetMainField(this); MiniFieldMap[i, j].SetStartPosition(new Vector2(j * 5 * TileInterval, i * 5 * TileInterval)); MiniFieldMap[i, j].SetInterval(TileInterval); MiniFieldMap[i, j].SetMap(dataMap); MiniFieldMap[i, j].Init(); } } } CurrentField = MiniFieldMap[CurrentMiniFieldIndexI, CurrentMiniFieldIndexJ]; CalculatePlayerIndex(); }