Placido_GDD

InputTextField

Jan 5th, 2022 (edited)
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class InputFields : MonoBehaviour
  6. {
  7.     public GameObject UI_Manager;
  8.     private Game_Manager UIManager;
  9.  
  10.     public float RefreshRate;
  11.     public int AliveChance;
  12.     // Start is called before the first frame update
  13.     void Start()
  14.     {
  15.         UIManager = UI_Manager.GetComponent<Game_Manager>();
  16.     }
  17.  
  18.     // Update is called once per frame
  19.     void Update()
  20.     {
  21.        
  22.     }
  23.  
  24.     public void InputRefreshRate(string stringInput)
  25.     {
  26.        if(float.TryParse(stringInput, out float value))
  27.         {
  28.             RefreshRate = value;
  29.         }
  30.        UIManager.speed = RefreshRate;
  31.        Debug.Log("Refresh rate:" + RefreshRate);
  32.     }
  33.     public void InputAliveChance(string stringInput)
  34.     {
  35.         if (int.TryParse(stringInput, out int value))
  36.         {
  37.             AliveChance = value;
  38.         }
  39.         UIManager.livingCells = AliveChance;
  40.         Debug.Log("Alive:" + AliveChance);
  41.        
  42.     }
  43. }
Add Comment
Please, Sign In to add comment