Ahoy Captain!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NumerWizard : MonoBehaviour
{
    int max = 1000;
    int min = 1;
    int guess = 500;

    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Ahoy! Captain, we've been expecting you!");
        Debug.Log("We need more recruits to our massive, newly bought ship!");
        Debug.Log("This will be the biggest treasure hunt yet!");
        Debug.Log("The highest number you can choose is: " + max + ".");
        Debug.Log("The lowest number you can choose is: " + min + ".");
        Debug.Log("Is your number lower than " + guess + "?");
        Debug.Log("Push up = Higher | Push Down = Lower | Push Enter = Correct.");
        max += 1;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Debug.Log("We need more recruits!");
            min = guess;
            guess = (max + min) / 2;
            Debug.Log("Is " + guess + " recruits good enough?");
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Debug.Log("We need less recruits!");
            max = guess;
            guess = (max + min) / 2;
            Debug.Log("Is " + guess + " recruits good enough?");
        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("Weigh anchor! Captain is hiring " + guess + " recruits!");
            Debug.Log("The crew: aye aye!");
        }
        else
        {
            return;
        }
    }
}

Privacy & Terms