diff --git a/Assets/Scripts/Dice.cs b/Assets/Scripts/Dice.cs index 48f13d1..3329f85 100644 --- a/Assets/Scripts/Dice.cs +++ b/Assets/Scripts/Dice.cs @@ -1,4 +1,5 @@ using System.Collections; +using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -14,7 +15,7 @@ public class Dice : MonoBehaviour { private Targyak targyak; public int[] diceResult = { 0, 0 }; - public int[] ujertek = {0,0}; + public List ujertek = new List(); public int valasztottErtek; //a jatekos altal valasztott dobott ertek helye private bool locked = false; //ne lehessen ujra kivalasztani a masikat ha mar tortent egy valasztas @@ -36,6 +37,10 @@ public class Dice : MonoBehaviour { public int dobott = 0; + private void Awake() { + + } + private void Start() { upgrade = FindObjectOfType(); ap = FindObjectOfType(); @@ -118,11 +123,13 @@ public class Dice : MonoBehaviour { if (adrenalinMegerosites) { //Debug.Log("belep"); targyak.CallAdrenalinLoket(); + yield return new WaitUntil(() => ujertek.Count > 0); if(mehet){ Debug.Log("belep mehet"); + Debug.Log("List: 0: " + ujertek[0] + " 1: " + ujertek[1]); diceResult[0] = targyak.ujertek1; diceResult[1] = targyak.ujertek2; - } + } } //deaktivalas Debug.Log("belep2"); @@ -130,14 +137,12 @@ public class Dice : MonoBehaviour { //HelyszinKiBekapcs(false); } - hely1.sprite = diceSides[diceResult[0]-1]; hely1.size = new Vector2(38, 38); hely2.sprite = diceSides[diceResult[1]-1]; hely2.size = new Vector2(38, 38); dobott++; - } public void HelyszinKiBekapcs(bool kikapcsolas){ @@ -148,20 +153,6 @@ public class Dice : MonoBehaviour { foreach(var item in colliders) item.gameObject.SetActive(true); } - - public IEnumerator waitbutton(){ - Debug.Log("belep wait"); - var waitForButton = new WaitForUIButtons(confirm, cancel); - yield return waitForButton.Reset(); - - if(waitForButton.PressedButton == confirm){ - adrenalinMegerosites = true; - }else{ - adrenalinMegerosites = false; - } - - adrenalinHasznalat.gameObject.SetActive(false); - } public void setAdrenalinMegerosites(bool adrenalinMegerosites) { this.adrenalinMegerosites = adrenalinMegerosites; diff --git a/Assets/Scripts/Targyak.cs b/Assets/Scripts/Targyak.cs index e066a02..dc186cb 100644 --- a/Assets/Scripts/Targyak.cs +++ b/Assets/Scripts/Targyak.cs @@ -13,12 +13,10 @@ public class Targyak : MonoBehaviour private Energia energia; private Ugynok ugynok; private Dice dice; - public TMP_InputField kocka1ertek; public TMP_InputField kocka2ertek; public int ujertek1; public int ujertek2; - public int targy_szamlalo = 0; public int adrenalinloket = 0; public int hackercsatlakozo = 0; @@ -29,12 +27,10 @@ public class Targyak : MonoBehaviour public bool lathatatlanOltozetAktivalva = false; public bool matavtaviranyitoAktivalva = false; private int randomszam; - public Button confirmNewValue; public Button cancelNewValue; - - private void Start() { + private void Awake() { akciok = FindObjectOfType(); elet = FindObjectOfType(); akciopont = FindObjectOfType(); @@ -95,6 +91,7 @@ public class Targyak : MonoBehaviour public IEnumerator AdrenalinLoket() { Debug.Log("adrenalin ienumerator"); + 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(); @@ -115,8 +112,8 @@ public class Targyak : MonoBehaviour if(waitForButton.PressedButton == confirmNewValue){ deactivateInputOk(true); - dice.ujertek[0] = ujertek1; //csak akkor adja at ha leokezta - dice.ujertek[1] = ujertek2; //uj adat amit a user adott meg + dice.ujertek.Add(ujertek1); //csak akkor adja at ha leokezta + dice.ujertek.Add(ujertek2); //uj adat amit a user adott meg dice.mehet = true; dice.HelyszinKiBekapcs(false); yield break; //kilepeshez @@ -138,8 +135,6 @@ public class Targyak : MonoBehaviour adrenalinloket = 0; //targy elvesztese } - - public void HackerCsatlakozo() { //kesz //+2 tolteny akciok.Betarazas(2); @@ -147,28 +142,29 @@ public class Targyak : MonoBehaviour elet.Eletplusz(); //+1 akcio akciopont.akciopont++; - + + hackercsatlakozo = 0; //targy elvesztese } public void LathatatlanOltozek() { //kesz //movement.mozgasHelyre(2, 2); //megadni inkabb a hely nevet ahova menni akar? | input field es nev megadas lathatatlanOltozetAktivalva = true; - + lathatatlanoltozet = 0; //targy elvesztese } - public void DroidGepagyu() { //kesz - + public void DroidGepagyu() { //kesz //ugynok cucc ugynok.canKill = true; //barhol meg tud olni ha kattint + droidgepagyu = 0; //targy elvesztese } public void MatavTaviranyito() { matavtaviranyitoAktivalva = true; + matavtaviranyito = 0; //targy elvesztese } public void FustGranat() { energia.granatAktivalva = true; - + fustgranat = 0; //targy elvesztese } - -} +} \ No newline at end of file