void Start() { estadoAtual = EstadosPlayer.Parado; animator = GetComponent <Animator>(); painelInventario = GameObject.FindGameObjectWithTag("PainelMetodos"); painelWork = GameObject.FindGameObjectWithTag("PainelBtWorkstation"); slots = painelWork.GetComponent <Transform>(); btPlay = GameObject.FindGameObjectWithTag("BtPlay"); countdown = timeCountdown; }
private void OnCollisionEnter2D(Collision2D collision) { Debug.LogWarning("entrou"); if (collision.gameObject.CompareTag("ColisorInferior")) { Debug.LogWarning("entrou2"); estadoAtual = EstadosPlayer.Morto; ChamaFimJogo(); } }
private void VerificaProximoMovimento() { if (comandosFinalList[movimentos].ToString() == "Mover") { Debug.Log("Mover"); estadoAtual = EstadosPlayer.Movendo; } else if (comandosFinalList[movimentos].ToString() == "Pular") { Debug.Log("Pular"); estadoAtual = EstadosPlayer.Pulando; } else if (comandosFinalList[movimentos].ToString() == "Delay") { PintarSlot(jogadaCount); jogadaCount++; countdown = timeCountdown; estadoAtual = EstadosPlayer.Delay; Debug.Log("Delay"); } else if (comandosFinalList[movimentos].ToString() == "Fim") { estadoAtual = EstadosPlayer.Parado; Debug.Log("Parado"); } else if (comandosFinalList[movimentos].ToString() == "Repetir2x") { //iniFor = estadoAtual = EstadosPlayer.Aguardando; Debug.Log("Parado"); } else if (comandosFinalList[movimentos].ToString() == "FimFor2x") { estadoAtual = EstadosPlayer.Aguardando; Debug.Log("Parado"); } else if (comandosFinalList[movimentos].ToString() == "Repetir4x") { estadoAtual = EstadosPlayer.Aguardando; Debug.Log("Parado"); } else if (comandosFinalList[movimentos].ToString() == "FimFor4x") { estadoAtual = EstadosPlayer.Aguardando; Debug.Log("Parado"); } else { Debug.Log("Opção Inválida: " + comandosFinalList[movimentos].ToString()); } movimentos++; }
public void AcaoBotaoPlay() { btPlay.GetComponent <Button>().interactable = false; comandosFinalList = new List <string>(); for (int i = 0; i < metodos.Length - 1; i++) { if (metodos[i].Trim().CompareTo("Repetir2x") == 0) { int primeiroI = i + 1; IList <string> listaFor = new List <string>(); listaFor.Add(metodos[i].Trim()); while (metodos[primeiroI].Trim().CompareTo("FimFor2x") != 0) { listaFor.Add(metodos[primeiroI].Trim()); primeiroI++; } for (int j = 0; j < 2; j++) { foreach (string m in listaFor) { comandosFinalList.Add(m); comandosFinalList.Add("Delay"); } if (j == 0) { comandosFinalList.Add("FimFor2x"); } } i = primeiroI; } if (metodos[i].Trim().CompareTo("Repetir4x") == 0) { int primeiroI = i + 1; IList <string> listaFor = new List <string>(); listaFor.Add(metodos[i].Trim()); while (metodos[primeiroI].Trim().CompareTo("FimFor4x") != 0) { listaFor.Add(metodos[primeiroI].Trim()); primeiroI++; } for (int j = 0; j < 4; j++) { foreach (string m in listaFor) { Debug.Log("comandosFinalList.Count:" + comandosFinalList.Count); comandosFinalList.Add(m); comandosFinalList.Add("Delay"); } } i = primeiroI; } //if (metodos[i].Trim().CompareTo("FimFor2x") == 0 || (metodos[i].Trim().CompareTo("FimFor4x") == 0)) //{ //} else { comandosFinalList.Add(metodos[i].Trim()); comandosFinalList.Add("Delay"); pintarSlots.Add(i); } } comandosFinalList.Add("Fim"); movimentos = 0; totalMovimentos = comandosFinalList.Count; estadoAtual = EstadosPlayer.Aguardando; executaPlay = true; slotsWork = painelWork.GetComponentsInChildren <Slot>(); foreach (string a in comandosFinalList) { Debug.Log(a); } Debug.Log("Inicio"); }
void Start() { estadoAtual = EstadosPlayer.Parado; //slots = GameObject.FindGameObjectWithTag("PainelBtWorkstation").GetComponent<Transform>(); animator = GetComponent <Animator>(); }