예제 #1
0
        /// <summary>
        /// Incrementa 'PowerUpBounces'. Quando atingi um certo número de 'bounces',
        /// escolhe qual será o powerup e ativa a linha de aviso.
        /// </summary>
        public void BounceOcurred()
        {
            PowerUpBounces++;

            if (PowerUpBounces == bouncesTillWarningLine)
            {
                powerUpType = CustomFuncs.RandomBool() ? PowerUpType.FIRE : PowerUpType.ICE;
                //powerUpType = PowerUpType.FIRE;
                //powerUpType = PowerUpType.ICE;

                linhaDeAviso.gameObject.SetActive(true);
                linhaDeAviso.GetComponent <SpriteRenderer>().color = powerUpType == PowerUpType.FIRE ? linhaDeAviso.corFogo : linhaDeAviso.corGelo;
            }

            if (PowerUpBounces == bouncesTillPowerUp)
            {
                lastBounceX = ball.transform.position.x;
            }
        }
예제 #2
0
        private void Start()
        {
            gameManager = FindObjectOfType <GameManager>();
            myCollider  = GetComponent <Collider2D>();

            foreach (Collider2D collider in FindObjectsOfType <Collider2D>())
            {
                if (collider.gameObject.GetComponent <BarraController>() != null)
                {
                    padColliders.Add(collider);
                }
            }

            //calcula minY e maxY
            Sprite sprite = GetComponent <SpriteRenderer>().sprite;

            maxY = Camera.main.orthographicSize - sprite.bounds.extents.y * transform.localScale.y;
            minY = -Camera.main.orthographicSize + sprite.bounds.extents.y * transform.localScale.y;

            //Joga bola
            velocity = (CustomFuncs.RandomBool()) ? Vector3.left * terminalSpeed * 0.5f : Vector3.right * terminalSpeed * 0.5f;
        }