using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Debug = UnityEngine.Debug;
public class NumberWizard : MonoBehaviour
{
int max;
int min;
int guess;
// Start is called before the first frame update
void Start()
{
StartGame();
}
void StartGame()
{
int max = 1000;
int min = 1;
int guess = 500;
Debug.Log("Hi welcome to number wizard");
Debug.Log("Are u ready for the game");
Debug.Log("Let's GO!!!");
Debug.Log("Pick a number and keep it as secret I'm going to guess what it is!");
Debug.Log("The highest number you can pick is: " + max);
Debug.Log("The lowest number you can pick is: " + min);
Debug.Log("Ok now Please tell me if your number is higher or lower than " + guess);
Debug.Log("Push Up = Higher, Push Down = Lower, Push Enter = Correct");
max = max + 1;
}
// Update is called once per frame
void Update()
{
//Detect when the down arrow key is pressed down
if (Input.GetKeyDown(KeyCode.UpArrow))
{
min = guess;
void NextGuess();
}
else if (Input.GetKeyDown(KeyCode.DownArrow))
{
max = guess;
void NextGuess();
}
else if (Input.GetKeyDown(KeyCode.Return))
{
Debug.Log("Well i figured it out");
void StartGame();
}
}
void NextGuess()
{
guess = (min+max) / 2;
Debug.Log("Is it lower or higher then: "+ guess);
}
}
Getting Error: Assets/NumberWizard.cs(47,18): error CS8112: ‘NextGuess()’ is a local function and must therefore always have a body.