//[yl] 创建新对象 private void CreateNewItem(int value = 2, int?row = null, int?col = null) { int emptyRow, emptyCol; if (row == null && col == null) { matrix.GetRandomRowCol(out emptyRow, out emptyCol); } else { emptyRow = row.Value; emptyCol = col.Value; } var newItem = new GameItem(); newItem.Value = value; newItem.Row = emptyRow; newItem.Column = emptyCol; var go = GetGOByValue(value); if (go == null) { Debug.LogError("Error value:" + value); return; } //[yl]anim go.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); newItem.GO = Instantiate(go, this.transform.position + new Vector3(emptyRow * DistancePerBlock, emptyCol * DistancePerBlock, ZIndex), Quaternion.identity) as GameObject; newItem.GO.transform.scaleTo(GlobalConst.AnimDuration, new Vector3(1, 1, 1)); matrix[emptyRow, emptyCol] = newItem; }