using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class NumberWizard : MonoBehaviour {
[SerializeField] int max;
[SerializeField] int min;
[SerializeField] TextMeshProUGUI guessText;
int guess;
// Use this for initialization
void Start ()
{
StartGame();
}
void StartGame()
{
guess = (max + min) / 2;
guessText.text = guess.ToString();
max = min + 1;
}
public void onPressHigher()
{
min = guess;
NextGuess();
}
public void onPressLower()
{
max = guess;
NextGuess();
}
void NextGuess()
{
guess = (max + min) / 2;
guessText.text = guess.ToString();
}
}
Hello!!!
When I start the game, we see the number 500 on the screen.
After that I press the Higher button, the result is not plus, but subtracted. And on the contrary, if you press Lower, it will be added. Sorry for my English, I used a translator, for I am from Ukraine