public void ClickConfirmButton() { bool missingAssignment = false; Stage1Tile tmpTile = null; for (int w = 0; w < gridWidth; w++) { for (int h = 0; h < gridHeight; h++) { tmpTile = stage1TileObjects[w, h].GetComponent <Stage1Tile>(); if (tmpTile.form != FORMS.Empty && tmpTile.material == MATERIALS.NONE) { Debug.Log("Missing Assignment"); Debug.Log("Width = " + w.ToString() + " || Height = " + h.ToString()); missingAssignment = true; panelMissingAssignment.SetActive(true); return; } } } if (missingAssignment == false) { stage1GUI.SetActive(false); stage2GUI.SetActive(true); stage2GridManager.selectedWeapon = selectedWeapon; stage2GridManager.selectedWeaponTemplate = weaponDictionary[selectedWeapon]; stage2GridManager.gameObject.SetActive(true); this.gameObject.SetActive(false); } }
public void CreateNewGrid() { GameObject gridHolder = GameObject.Find("Stage1GridHolder"); if (gridHolder != null) { DestroyImmediate(gridHolder); } gridHolder = new GameObject("Stage1GridHolder"); gridHolder.transform.SetParent(this.transform); stage1TileObjects = new GameObject[gridWidth, gridHeight]; for (int width = 0; width < gridWidth; width++) { for (int height = 0; height < gridHeight; height++) { // if ((FORMS)bluePrint_Dagger[0, width, height] != FORMS.Empty) { GameObject tmpObject = (GameObject)Instantiate(prefabTileStage1, new Vector3(width * tileSize, height * tileSize, 0), prefabTileStage1.transform.rotation, gridHolder.transform); tmpObject.name = "Stage1Tile_W" + width.ToString() + "_H" + height.ToString(); Stage1Tile stage1Tile = tmpObject.GetComponent <Stage1Tile>(); stage1Tile.form = (FORMS)weaponDictionary[WEAPONTYPE.Dagger][0, width, height]; stage1Tile.materialGroup = (MATERIALGROUPS)weaponDictionary[WEAPONTYPE.Dagger][1, width, height]; stage1Tile.gridManager = this; int spriteNumber = TileSpriteOptionsList.FindIndex(x => x == stage1Tile.form); tmpObject.GetComponent <SpriteRenderer>().sprite = TileSpriteSpriteList[spriteNumber]; stage1TileObjects[width, height] = tmpObject; } } } }