Ejemplo n.º 1
0
    bool fansDownStand0(int _lvl)
    {
        float stepX = Random.Range(.01f, .3f);

        //stand0
        for (float tmpPosX = -3.4f + stepX; tmpPosX < 3.4; tmpPosX += stepX)
        {
            float tmpPosY    = Random.Range(-6.025f, -5.975f);
            float tmpRotateZ = 0.1f - (0.2f * (Mathf.Abs(tmpPosX - 3.4f) / 6.8f));

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

                //Quaternion.identity

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

                fansList.Add(tmpObj);
            }

            stepX = Random.Range(.4f, .5f);
        }
        return(true);
    }
Ejemplo n.º 2
0
 string getBigFanSpriteName(int _nrFan)
 {
     return(BananasTypesFans.getFanBigName(_nrFan));
 }
Ejemplo n.º 3
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);
    }