Exemplo n.º 1
0
    bool fansKidsLeft(int _lvl)
    {
        float stepY = Random.Range(0.01f, 0.1f);

        for (float tmpPosY = -5f + stepY; tmpPosY < 5; tmpPosY += stepY)
        {
            float tmpPosX    = Random.Range(-3.66f, -3.55f);
            float tmpRotateZ = -1.5f + (1f * (Mathf.Abs(tmpPosY - 5f) / 10f));

            if (Random.value * 100 < _lvl)
            {
                GameObject tmpObj = Instantiate(fanSmallPre, new Vector3(tmpPosX, tmpPosY, 0.0f), new Quaternion(0, 0, tmpRotateZ, 1), gameObject.transform);

                tmpObj.GetComponent <SpriteRenderer>().sprite = fansAtlas.GetSprite(BananasTypesFans.getFanSmallName(Random.Range(0, typeFansRange)));

                fansList.Add(tmpObj);
            }

            stepY = Random.Range(.4f, .6f);
        }
        return(true);
    }
Exemplo n.º 2
0
    bool makeOneFan(int _lvl,
                    int _hwSize,            //_hwSize 0=big 1=small,
                    float _posX, float _spreadPosX,
                    float _posY, float _spreadPosY,
                    float _rotateZ, float _spreadRotateZ,
                    int _orderInLayer)
    {
        if (Random.value * 100 < _lvl)
        {
            float tmpPosX    = _posX + Random.Range(-_spreadPosX, _spreadPosX);
            float tmpPosY    = _posY + Random.Range(-_spreadPosY, _spreadPosY);
            float tmpRotateZ = (_rotateZ + Random.Range(-_spreadRotateZ, _spreadRotateZ)) / 90f;
            Debug.Log("makeOneFam tmpRotateZ: " + tmpRotateZ);
            GameObject tmpObj = null;

            if (_hwSize == 0)
            {
                tmpObj = Instantiate(fanBigPre, new Vector3(tmpPosX, tmpPosY, 0.0f), new Quaternion(0, 0, tmpRotateZ, 1), gameObject.transform);
                tmpObj.GetComponent <SpriteRenderer>().sprite       = fansAtlas.GetSprite(BananasTypesFans.getFanBigName(Random.Range(0, typeFansRange)));
                tmpObj.GetComponent <SpriteRenderer>().sortingOrder = _orderInLayer;
            }
            else if (_hwSize == 1)
            {
                tmpObj = Instantiate(fanSmallPre, new Vector3(tmpPosX, tmpPosY, 0.0f), new Quaternion(0, 0, tmpRotateZ, 1), gameObject.transform);
                tmpObj.GetComponent <SpriteRenderer>().sprite       = fansAtlas.GetSprite(BananasTypesFans.getFanSmallName(Random.Range(0, typeFansRange)));
                tmpObj.GetComponent <SpriteRenderer>().sortingOrder = _orderInLayer;
            }

            fansList.Add(tmpObj);
        }

        return(true);
    }