public void DestroyPeek(ScoreType score) { /*distance é variável gambiarra aqui:*/ float distance = Mathf.Abs(this.transform.position.y - peekArrowScript.transform.position.y); if (score != ScoreType.fail && /*Gambiarra:*/ distance < PlayerController.almostDistance) { if (score == ScoreType.wrongArrow) { //gambiarra if if (unqueuedDeadArrow != null) { Destroy(unqueuedDeadArrow); } unqueuedDeadArrow = ArrowQueue.Peek(); unqueuedDeadArrow.GetComponent <SpriteRenderer>().color = Color.gray; } else { ArrowQueue.Peek().GetComponent <SpriteRenderer>().color = Color.white; peekArrowScript.animator.Play("ArrowExplode"); Destroy(ArrowQueue.Peek(), 1f); } ArrowQueue.Dequeue(); if (ArrowQueue.Count > 0) { peekArrowScript = ArrowQueue.Peek().GetComponent <Arrow>(); ArrowQueue.Peek().GetComponent <SpriteRenderer>().color = Color.cyan; } } }
private void CheckDeadZone() { if (ArrowQueue.Count > 0 && ArrowQueue.Peek().transform.position.y < unqueueZone) { unqueuedDeadArrow = ArrowQueue.Peek(); ArrowQueue.Dequeue(); unqueuedDeadArrow.GetComponent <SpriteRenderer>().color = Color.gray; //######### if (ArrowQueue.Count > 0) { peekArrowScript = ArrowQueue.Peek().GetComponent <Arrow>(); ArrowQueue.Peek().GetComponent <SpriteRenderer>().color = Color.cyan; } } if (unqueuedDeadArrow != null && unqueuedDeadArrow.transform.position.y < deadZone) { Destroy(unqueuedDeadArrow); } }