Question by
caiotarcizo · Nov 05, 2020 at 08:11 PM ·
inputinputfieldsortingcomparesort
Compare and sort Input
I'm making a code where there are several inputfields that the player needs to fill in with a number. Now I need a code that takes these various inputs, and compare their value, to see if they are greater than X, less than Y, or if they are in between those values, to then classify these values as Green, Red or Yellow. Lastly, I need to see which one is in greater quantity, green, red or yellow, to determine which animation will play on an object.
I'm not asking for a ready-made script, it just helps because my programming knowledge is limited. Below is the script I made:
public class Calcular : MonoBehaviour {
public int ProduçaoPontoCritico;
public int ProduçaoMeta;
public int ProdutividadePontoCritico;
public int ProdutividadeMeta;
public int PerdaPontoCritico;
public int PerdaMeta;
public Button botaoo;
public GameObject botao;
public GameObject botaomenu;
public GameObject menu;
public GameObject informacoes;
//TURNO 1
public InputField input1efi1;
int turno1efi1;
public InputField input1efi2;
int turno1efi2;
public InputField input1efi3;
int turno1efi3;
public InputField input1efi4;
int turno1efi4;
public InputField input1efi5;
int turno1efi5;
public InputField input1efi6;
int turno1efi6;
public InputField input1prod1;
int turno1prod1;
public InputField input1prod2;
int turno1prod2;
public InputField input1prod3;
int turno1prod3;
public InputField input1prod4;
int turno1prod4;
public InputField input1prod5;
int turno1prod5;
public InputField input1prod6;
int turno1prod6;
public InputField input1perda;
int turno1perda;
//TURNO 2
public InputField input2efi1;
int turno2efi1;
public InputField input2efi2;
int turno2efi2;
public InputField input2efi3;
int turno2efi3;
public InputField input2efi4;
int turno2efi4;
public InputField input2efi5;
int turno2efi5;
public InputField input2efi6;
int turno2efi6;
public InputField input2prod1;
int turno2prod1;
public InputField input2prod2;
int turno2prod2;
public InputField input2prod3;
int turno2prod3;
public InputField input2prod4;
int turno2prod4;
public InputField input2prod5;
int turno2prod5;
public InputField input2prod6;
int turno2prod6;
public InputField input2perda;
int turno2perda;
//TURNO 3
public InputField input3efi1;
int turno3efi1;
public InputField input3efi2;
int turno3efi2;
public InputField input3efi3;
int turno3efi3;
public InputField input3efi4;
int turno3efi4;
public InputField input3efi5;
int turno3efi5;
public InputField input3efi6;
int turno3efi6;
public InputField input3prod1;
int turno3prod1;
public InputField input3prod2;
int turno3prod2;
public InputField input3prod3;
int turno3prod3;
public InputField input3prod4;
int turno3prod4;
public InputField input3prod5;
int turno3prod5;
public InputField input3prod6;
int turno3prod6;
public InputField input3perda;
int turno3perda;
void Start()
{
Button btn = botao.GetComponent<Button>();
btn.onClick.AddListener(TaskOnClick);
}
void Update()
{
//TURNO 1
turno1efi1 = int.Parse(input1efi1.text);
turno1efi2 = int.Parse(input1efi2.text);
turno1efi3 = int.Parse(input1efi3.text);
turno1efi4 = int.Parse(input1efi4.text);
turno1efi5 = int.Parse(input1efi5.text);
turno1efi6 = int.Parse(input1efi6.text);
turno1prod1 = int.Parse(input1prod1.text);
turno1prod2 = int.Parse(input1prod2.text);
turno1prod3 = int.Parse(input1prod3.text);
turno1prod4 = int.Parse(input1prod4.text);
turno1prod5 = int.Parse(input1prod5.text);
turno1prod6 = int.Parse(input1prod6.text);
turno1perda = int.Parse(input1perda.text);
//TURNO 2
turno1efi1 = int.Parse(input2efi1.text);
turno1efi2 = int.Parse(input2efi2.text);
turno1efi3 = int.Parse(input2efi3.text);
turno1efi4 = int.Parse(input2efi4.text);
turno1efi5 = int.Parse(input2efi5.text);
turno1efi6 = int.Parse(input2efi6.text);
turno2prod1 = int.Parse(input2prod1.text);
turno2prod2 = int.Parse(input2prod2.text);
turno2prod3 = int.Parse(input2prod3.text);
turno2prod4 = int.Parse(input2prod4.text);
turno2prod5 = int.Parse(input2prod5.text);
turno2prod6 = int.Parse(input2prod6.text);
turno2perda = int.Parse(input2perda.text);
//TURNO 3
turno3efi1 = int.Parse(input2efi1.text);
turno3efi2 = int.Parse(input2efi2.text);
turno3efi3 = int.Parse(input2efi3.text);
turno3efi4 = int.Parse(input2efi4.text);
turno3efi5 = int.Parse(input2efi5.text);
turno3efi6 = int.Parse(input2efi6.text);
turno3prod1 = int.Parse(input3prod1.text);
turno3prod2 = int.Parse(input3prod2.text);
turno3prod3 = int.Parse(input3prod3.text);
turno3prod4 = int.Parse(input3prod4.text);
turno3prod5 = int.Parse(input3prod5.text);
turno3prod6 = int.Parse(input3prod6.text);
turno3perda = int.Parse(input3perda.text);
}
void TaskOnClick()
{
menu.SetActive(false);
botao.SetActive(false);
informacoes.SetActive(false);
botaomenu.SetActive(true);
}
public Valor GetBiggestValue()
{
}
void CalcularMetas()
{
}
}
Thanks
Comment
Your answer
Follow this Question
Related Questions
Input Field between scenes 0 Answers
Array sorting issues - Please Help!!! 4 Answers
Input Field Problem 0 Answers