Hello everyone!
I’m from Spain so I set my Debug.Logs in spanish. I guess no one check my code or even this post, so it doesn’t care what I write here.
And remember:
¡Siempre a tope!
// Welcome to my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumbeWizard : MonoBehaviour
{
int max = 1000;
int min = 1;
int guess = 500;
// Use this for initialization
void Start ()
{
Debug.Log("Bienvenida sea tu persona al mago de los números.");
Debug.Log("Escoge un número. ¡Pero no lo digas en voz alta!");
Debug.Log("El número más alto que podrás escoger es el " + max + " y el más bajo el " + min + "-incluso yo tengo mis limitaciones-.");
Debug.Log("Por favor, dime si el número que has escogido es el " + guess + ", es mayor o es menor.");
Debug.Log("[Pulsa la FLECHA HACIA ARRIBA si es mayor. Pulsa la FLECHA HACIA ABAJO si es menor. Si el mago de los números ha acertado pulsa INTRO");
max = max + 1;
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
guess = (max + min) / 2;
Debug.Log("¿Es el " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
guess = (max + min) / 2;
Debug.Log("¿Es el " + guess + "?");
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("¡Lo sabía!");
}
}
}