Beispiel #1
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    public static IEnumerator CheckChildCount(Transform thisTransform, GameObject gameObject)
    {
        //--------------

        int counter0 = 0;

        while (true)
        {
            yield return(delay0);

            if (thisTransform.childCount == 0)
            {
                ChunkCubesPool.TakeCube(gameObject);
            }
            else if (thisTransform.childCount > 0 && thisTransform.childCount <= 2)
            {
                if (counter0++ >= 75)
                {
                    counter0 = 0;
                    if (Class_Controller.SqrMagnitudeToPlayer(thisTransform) > 250000)
                    {
                        ChunkCubesPool.TakeCube(gameObject);
                    }
                }
            }
        }

        //--------------
    }
Beispiel #2
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    IEnumerator SplitСube()
    {
        //--------------

        amountDamage += currentDamage;

        if (amountDamage >= 10.0f + (faultSize * 0.5f) && brokenStage0 == false)
        {
            brokenStage0 = true;
            StartCoroutine(Class_ChunkCube.CheckChildCount(thisTransform, gameObject));
            if (thisScaleX > faultSize * faultSizeOptimize)
            {
                Class_ChunkCube.CubeOutOfPool(thisTransform, numberCubeOutOfPool, cubeOutOfPoolScale, uvOffset);
                thisRenderer.enabled    = false;
                thisBoxCollider.enabled = false;
            }
            else
            {
                outPool = false;

                if (visible == true)
                {
                    Class_ChunkCube.ParticlesOutOfPool(thisTransform, ExplosionParticlesPool.GiveExplosionParticle(0), Random.Range(0.75f, 1.25f));
                    Class_ChunkCube.ParticlesOutOfPool(thisTransform, ExplosionParticlesPool.GiveExplosionParticle(1), Random.Range(0.75f, 1.25f));
                    for (int i = 0; i < numberDebris; i++)
                    {
                        Class_ChunkCube.DebrisOutOfPool(thisTransform, thisRenderer, DebrisesPool.GiveDebris(Random.Range(0, 2)), numberDebris, Random.Range(0.4f, 0.9f), uvOffset);
                    }
                }

                Class_Mineral.RandomMinerals(thisTransform);
                yield return(delay0);

                ChunkCubesPool.TakeCube(gameObject);
            }
        }

        //--------------
    }