Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
        private void SpawnArrow(Direction direction, float spawnPositionY, float z)
        {
            GameObject newArrow = Instantiate(arrowPrefab, new Vector3(this.transform.position.x, spawnPositionY, z), Quaternion.identity, this.transform);

            newArrow.GetComponent <Arrow>().Initialize(direction, 1);
            ArrowQueue.Enqueue(newArrow);
            peekArrowScript = ArrowQueue.Peek().GetComponent <Arrow>();
            ArrowQueue.Peek().GetComponent <SpriteRenderer>().color = Color.cyan;
        }
Beispiel #3
0
 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);
     }
 }