Search Unity

Question Cant seem to convert this c# script to bolt. Could anyone help me with creating these functions

Discussion in 'Visual Scripting' started by Amnos3d, Jan 17, 2021.

  1. Amnos3d

    Amnos3d

    Joined:
    Oct 2, 2020
    Posts:
    1
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.UI;
    4.  
    5. public class NumberWizards : MonoBehaviour {
    6.  
    7.     public Text guessText;
    8.    
    9.     int max = 1000;
    10.     int min = 1;
    11.     int guess;
    12.    
    13.     void Start () {
    14.         StartGame();
    15.     }
    16.    
    17.     void StartGame () {
    18.         max = max + 1;
    19.         NextGuess();
    20.     }
    21.  
    22.     public void GuessHigher(){
    23.         min = guess;
    24.         NextGuess();
    25.     }
    26.  
    27.     public void GuessLower(){
    28.         max = guess;
    29.         NextGuess ();
    30.     }
    31.  
    32.     public void GuessCorrect(){
    33.         StartGame ();
    34.     }
    35.    
    36.     void NextGuess () {
    37.         //guess = (max + min) / 2;
    38.         guess = Random.Range(min, max);
    39.         print ("Next guess is " + guess);
    40.         guessText.text = guess.ToString();
    41.     }
    42. }
    43.