Files
findthesource/Assets/Scripts/Kezdohelyszin.cs

41 lines
1006 B
C#
Raw Normal View History

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Kezdohelyszin : MonoBehaviour
{
public SpriteRenderer dice1;
public SpriteRenderer dice2;
public TMP_Text eredmenyText;
public Button nextButton;
private int random;
2023-04-20 16:14:47 +02:00
public static bool kesz = false;
private Dice dice;
private void Awake() {
dice = FindObjectOfType<Dice>();
nextButton.interactable = false;
}
public void KezdoHelyszinSorsolas(int x, int y, string helynev){
2023-04-20 16:14:47 +02:00
eredmenyText.text = "";
nextButton.interactable = false;
StartCoroutine(waitForDiceAnimation(helynev));
dice.callAnimateDice(dice1, x);
dice.callAnimateDice(dice2, y);
}
private IEnumerator waitForDiceAnimation(string helynev){
2023-04-20 16:14:47 +02:00
yield return new WaitUntil(() => kesz);
eredmenyText.text = "A kezdőhelyszíned: " + helynev;
2023-04-20 16:14:47 +02:00
nextButton.interactable = true;
kesz = false;
}
}