diff --git a/Assets/Scripts/Dice.cs b/Assets/Scripts/Dice.cs index 6ea00ca..f87d5b0 100644 --- a/Assets/Scripts/Dice.cs +++ b/Assets/Scripts/Dice.cs @@ -78,7 +78,7 @@ public class Dice : MonoBehaviour { diceResult[0] = RollDice(); diceResult[1] = RollDice(); - if(targyak.adrenalinloket > 0) { + /*if(targyak.adrenalinloket > 0) { //text aktivalasa kerdesre hogy akarja e hasznalni a targyat adrenalinHasznalat.SetActive(true); //ha igen gomb -> valtozo igaz, targy fv meghivas, deaktivalas @@ -90,9 +90,26 @@ public class Dice : MonoBehaviour { //deaktivalas adrenalinHasznalat.gameObject.SetActive(false); adrenalinMegerosites = false; - } + }*/ } while (diceResult[0] == diceResult[1]); + if(targyak.adrenalinloket > 0) { + Debug.Log("belep"); + //text aktivalasa kerdesre hogy akarja e hasznalni a targyat + adrenalinHasznalat.SetActive(true); + //ha igen gomb -> valtozo igaz, targy fv meghivas, deaktivalas + //VARNIA KELL A GOMBRA + if (adrenalinMegerosites) { + int[] ujertek = targyak.AdrenalinLoket(); + diceResult[0] = ujertek[0]; + diceResult[1] = ujertek[1]; + } + //deaktivalas + adrenalinHasznalat.gameObject.SetActive(false); + adrenalinMegerosites = false; + } + + hely1.sprite = diceSides[diceResult[0]-1]; hely1.size = new Vector2(38, 38); diff --git a/Assets/Scripts/Targyak.cs b/Assets/Scripts/Targyak.cs index 657530f..178e39d 100644 --- a/Assets/Scripts/Targyak.cs +++ b/Assets/Scripts/Targyak.cs @@ -87,10 +87,12 @@ public class Targyak : MonoBehaviour } public int[] AdrenalinLoket() { - kocka1ertek.text = dice.getDices()[0].ToString(); - kocka2ertek.text = dice.getDices()[1].ToString(); + //kocka1ertek.text = dice.getDices()[0].ToString(); //maradjon uresen es jelenjen meg kepen a kocka ertekek, hogy while-al varakoztatni lehessen? + //kocka2ertek.text = dice.getDices()[1].ToString(); kocka1ertek.gameObject.SetActive(true); //aktivalja az input mezot hogy meg lehessen adni az uj erteket kocka2ertek.gameObject.SetActive(true); + //ITT IS VARNI KELL? + ujertek1 = int.Parse(kocka1ertek.text); ujertek2 = int.Parse(kocka2ertek.text); //hogy tunik el az elozo? || egymas melle kerul a ket input vagy gomb ami deaktivalja a inputot int[] eredmeny = {ujertek1, ujertek2}; diff --git a/Assets/Scripts/WaitForUIButtons.cs b/Assets/Scripts/WaitForUIButtons.cs new file mode 100644 index 0000000..c828422 --- /dev/null +++ b/Assets/Scripts/WaitForUIButtons.cs @@ -0,0 +1,76 @@ +//Code provided by Bunny83 on https://answers.unity.com/questions/1651268/need-help-setting-up-ui-button-functionality-in-co.html + +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.UI; + +public class WaitForUIButtons : CustomYieldInstruction, System.IDisposable +{ + private struct ButtonCallback + { + public Button button; + public UnityAction listener; + } + private List m_Buttons = new List(); + private System.Action