Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class botonseguro : MonoBehaviour
- {
- public int x;
- bool botonhasidopulsado = false;
- public bool ganar;
- public void boton1pulsado()
- {
- x = 1;
- botonhasidopulsado = true;
- Debug.Log(x);
- Debug.Log(botonhasidopulsado);
- }
- public void boton2pulsado()
- {
- x = 2;
- botonhasidopulsado = true;
- Debug.Log(x);
- Debug.Log(botonhasidopulsado);
- }
- public void boton3pulsado()
- {
- x = 3;
- botonhasidopulsado = true;
- Debug.Log(x);
- Debug.Log(botonhasidopulsado);
- }
- public void boton4pulsado()
- {
- x = 4;
- botonhasidopulsado = true;
- Debug.Log(x);
- Debug.Log(botonhasidopulsado);
- }
- public void boton6pulsado()
- {
- x = 6;
- botonhasidopulsado = true;
- Debug.Log(x);
- Debug.Log(botonhasidopulsado);
- }
- void Start()
- {
- List<int> botonesquehansalido = new List<int>();
- int boton;
- while (ganar)
- {
- boton = UnityEngine.Random.Range(1, 5);
- botonesquehansalido.Add(boton);
- foreach (int numero in botonesquehansalido)
- {
- switch (numero)
- {
- case 1:
- Debug.Log("a1");
- break;
- case 2:
- Debug.Log("a2");
- break;
- case 3:
- Debug.Log("a3");
- break;
- case 4:
- Debug.Log("a4");
- break;
- }
- }
- if (botonhasidopulsado == true)
- {
- foreach (int numeroc in botonesquehansalido)
- {
- //entrada de tocar, si tocar no es el boton que era, de momento lo hago con x
- if (x == numeroc)
- {
- ganar = true;
- }
- else if (x != numeroc)
- {
- ganar = false;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement