public void SetUpPowerPanel(RuntimeAnimatorController powerAnimCon) { powerPanel = guiScr.CreatePanel(gameManager.gameObject, "PowerPanel", new Vector2(0.5f, 1), new Vector2(0.5f, 1), new Vector3(0.5f, 1), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(POWERS_COUNT * (POWER_BUTTON_SIZE + POWER_BUTTON_OFFSET_X) - POWER_BUTTON_OFFSET_X, COLORS_COUNT * (POWER_BUTTON_SIZE + POWER_BUTTON_OFFSET_Y) + POWER_BUTTON_SIZE), new Vector2(0, -90), spr, new Color32(0, 255, 0, 100)); powerTab = new GameObject[POWERS_COUNT, COLORS_COUNT]; for (int x = 0; x < POWERS_COUNT; x++) { for (int y = 0; y < COLORS_COUNT; y++) { powerTab[x, y] = guiScr.CreateButton(powerPanel, "PowerButton", new Vector2(0, 1), new Vector2(0, 1), new Vector2(0, 1), new Vector3(1, 1, 1), new Vector3(0, 0), new Vector2(POWER_BUTTON_SIZE, POWER_BUTTON_SIZE), new Vector2((x * (POWER_BUTTON_SIZE + POWER_BUTTON_OFFSET_X)), -(y * (POWER_BUTTON_SIZE + POWER_BUTTON_OFFSET_Y))), powerSprites[(x + (y * POWERS_COUNT))], new Color32(255, 255, 255, 255)); GameObject txt = guiScr.CreateText(powerTab[x, y], "Txt", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(30, 25), new Vector2(0, -5), (BASE_POWER_COST * (x + 1)).ToString(), new Color32(0, 0, 255, 255)); powerTab[x, y].AddComponent <PowerScript>(); powerTab[x, y].GetComponent <PowerScript>().SetUpPower(BASE_POWER_COST * (x + 1), BASE_POWER_DAMAGE, y, x, powerAnimCon); int _x = x; int _y = y; guiScr.SetAction(powerTab[x, y], _x, _y, new action3(gameManager.Attack)); } } GameObject but = guiScr.CreateButton(powerPanel, "PassButton", new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector3(1, 1, 1), new Vector3(0, 0), new Vector2(POWER_BUTTON_SIZE, POWER_BUTTON_SIZE), new Vector2(0, 0), waitSprite, new Color32(255, 255, 255, 255)); guiScr.SetAction(but, new action2(gameManager.EnemyMove)); }
private void SetUpGui() { guiPanel = guiScr.CreatePanel(gameObject, "GuiPanel", new Vector2(0, 0.5f), new Vector2(0, 0.5f), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(150, 400), new Vector2(100, 0), spr, new Color32(0, 0, 0, 0)); levelView = guiScr.CreateText(guiPanel, "Level", new Vector2(0.5f, 1), new Vector2(0.5f, 1), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(150, 50), new Vector2(0, -25), ("Level: " + level.ToString()), new Color32(0, 0, 0, 255)); targetView = guiScr.CreateText(guiPanel, "Target", new Vector2(0.5f, 1), new Vector2(0.5f, 1), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(150, 50), new Vector2(0, -75), ("Target: " + target.ToString()), new Color32(0, 0, 0, 255)); inPlayView = guiScr.CreateText(guiPanel, "Blocks in play", new Vector2(0.5f, 1), new Vector2(0.5f, 1), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(150, 50), new Vector2(0, -125), ("Blocks in play: " + inPlay.ToString()), new Color32(0, 0, 0, 255)); exitButton = guiScr.CreateButton(guiPanel, "Blocks in play", new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(150, 50), new Vector2(0, 25), spr, new Color32(255, 255, 255, 255)); guiScr.CreateText(exitButton, "ButtonText", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector2(150, 50), new Vector2(0, 0), ("EXIT"), new Color32(0, 0, 1, 255)); exitButton.GetComponent <Button>().onClick.AddListener(delegate { Application.Quit(); }); }