void Update() { if (ls.Lose()) { rb.velocity = Vector2.zero; } if (life <= 0) { Die(); } anim.SetBool("Parado", ls.Lose()); }
void Update() { if (!ls.Lose()) { if (Input.GetKeyDown(KeyCode.RightArrow) && !uc.Paused()) { pc.controlChar(true); pk.shoot(); } if (Input.GetKeyDown(KeyCode.LeftArrow) && !uc.Paused()) { pc.controlChar(false); pk.shoot(); } } }
public IEnumerator rightAnimation(bool rTc, bool rTl) { attackPosition = false; //direita para o centro if (rTc) { //-----------------------------------direita sprt.sprite = r; yield return(new WaitForSeconds(movementDelay)); //virada pra direita sprt.sprite = tr; yield return(new WaitForSeconds(movementDelay)); //-----------------------------------centro sprt.sprite = c; attackPosition = true; //-----------------------------------direita para a esquerda if (rTl) { StartCoroutine(leftAnimation(false, false)); } } //-----------------------------------centro para direita else { //-----------------------------------centro sprt.sprite = c; yield return(new WaitForSeconds(movementDelay)); //-----------------------------------virando para direita sprt.sprite = tr; yield return(new WaitForSeconds(movementDelay)); //-----------------------------------direita sprt.sprite = r; attackPosition = true; if (!ls.Lose()) { pc.shoot(); } } }
public IEnumerator EnemySpawner() { while (!ls.Lose()) { if (randomicNumber(0, 100) > 50) { Instantiate(Enemy(), spawnPositions[0].position, spawnPositions[0].rotation); right = true; } else { right = false; Instantiate(Enemy(), spawnPositions[1].position, spawnPositions[1].rotation); } yield return(new WaitForSeconds(sp.Seg())); } }