public void RecebeCola() { alState = AlunoStates.CHEATING; animator.SetBool("temCola", true); tempoMinimo = tempoMinimoDefinido; progressoCola.SetActive(true); if (needsCheat == this) { aSource.clip = sounds[(int)AlunoSounds.Receive]; aSource.Play(); DataCollector.alunosAtendidos++; bonusSpeed |= true; NeedsCheat(false); } }
private void NeedsCheat(bool needs) { if (needs) { needsCheat = this; //GetComponent<SpriteRenderer>().color = new Color(1, 0, 0); alState = AlunoStates.ASKING; animator.SetBool("requestCheat", true); } else { needsCheat = null; animator.SetBool("requestCheat", false); //GetComponent<SpriteRenderer>().color = new Color(1, 1, 1); } }
public void PassaCola(Vector3 direction) { if (direction.x < 0) { animator.SetInteger("direcao", 1); if (!animator.GetBool("olhandoEsquerda")) { Flip(); } } else if (direction.x > 0) { animator.SetInteger("direcao", 2); if (animator.GetBool("olhandoEsquerda")) { Flip(); } } if (direction.y > 0) { animator.SetInteger("direcao", 3); } else if (direction.y < 0) { animator.SetInteger("direcao", 4); } if (terminou) { alState = AlunoStates.FINISHED; } else { alState = AlunoStates.IDLE; } animator.SetTrigger("passandoACola"); animator.SetBool("temCola", false); aSource.clip = sounds[(int)AlunoSounds.PassaCola]; aSource.Play(); progressoCola.SetActive(false); colaNasCostas = false; bonusSpeed = false; meanLabel.text = "Media da turma: " + GetMean().ToString("0.0"); }
// Update is called once per frame void Update() { if (GameManager.IsGameOver()) { return; } switch (alState) { case AlunoStates.IDLE: TryAskingForCheat(); break; case AlunoStates.CHEATING: if (animator.GetFloat("tempoComCola") < tempoNecessario) { if (!aSource.isPlaying) { aSource.clip = sounds[(int)AlunoSounds.Colando]; aSource.Play(); } MostraProgressoCola(); } if (tempoMinimo > 0) { tempoMinimo -= Time.deltaTime; } break; case AlunoStates.ASKING: needsCheatTimer -= Time.deltaTime; if (needsCheatTimer < 0) { DataCollector.alunosNaoAtendidos++; NeedsCheat(false); alState = AlunoStates.IDLE; } break; case AlunoStates.BUSTED: break; case AlunoStates.FINISHED: break; } }
public void Busted() { DataCollector.alunosPegos++; //Se chegou no limite de alunos que podem ser pegos, game over //Debug.Log(debugTag + "Busted: " + bustedCounter + "| Chances: " + chances); slingshot.Released(); if (++bustedCounter >= chances) { GameManager.GameOver(); } else { //Se ainda estiver para receber a cola, //ja considera que recebeu (professor pega os dois) if (Cola.GetReceiver() == this) { RecebeCola(); } //O que o aluno tinha de pontos não soma mais na média da turma cheatProgress[(int)position.x, (int)position.y] = 0; //se ele tinha terminado, é desconsiderado if (terminou) { --finishedCounter; } alState = AlunoStates.BUSTED; GetComponent <SpriteRenderer>().color = new Color(0.4f, 0.4f, 0.4f); busted = true; tempoMinimo = 0; aSource.Stop(); aSource.clip = sounds[(int)AlunoSounds.Busted]; aSource.Play(); animator.SetBool("temCola", false); animator.SetTrigger("busted"); progressoCola.SetActive(false); meanLabel.text = "Media da turma: " + GetMean().ToString("0.0"); } }