Exemplo n.º 1
0
        public void SetGood()
        {
            good.gameObject.SetActive(true);

            float leftSide  = 0;
            float rightSide = width - good.GetComponent <SpriteRenderer>().size.x;

            if (barrierLeft.IsActive())
            {
                leftSide += barrierLeft.width;
            }
            if (barrierRight.IsActive())
            {
                rightSide -= barrierRight.width;
            }

            good.transform.localPosition = new Vector3(
                Random.Range(leftSide, rightSide),
                good.transform.localPosition.y
                );
        }