// Use this for initialization
    void Start()
    {
        AsteraX.AddAsteroid(this);

        transform.localScale = Vector3.one * size * AsteraX.AsteroidsSO.asteroidScale;
        if (parentIsAsteroid)
        {
            InitAsteroidChild();
        }
        else
        {
            InitAsteroidParent();
        }

        // Spawn child Asteroids
        if (size > 1)
        {
            Asteroid ast;
            //for (int i=0; i<AsteraX.AsteroidsSO.numSmallerAsteroidsToSpawn; i++) {
            for (int i = 0; i < AsteraX.GetLevelInfo().numSubAsteroids; i++)
            {
                ast      = SpawnAsteroid();
                ast.size = size - 1;
                ast.transform.SetParent(transform);
                Vector3 relPos = Random.onUnitSphere / 2;
                ast.transform.rotation      = Random.rotation;
                ast.transform.localPosition = relPos;

                ast.gameObject.name = gameObject.name + "_" + i.ToString("00");
            }
        }
    }
    void SetState(eLevelAdvanceState newState)
    {
        stateStartTime = realTime;

        switch (newState)
        {
        case eLevelAdvanceState.idle:
            gameObject.SetActive(false);
            if (idleCallback != null)
            {
                idleCallback();
                idleCallback = null;
            }
            break;

        case eLevelAdvanceState.fadeIn:
            gameObject.SetActive(true);
            // Set text
            levelText.text     = "Level " + AsteraX.GAME_LEVEL;
            levelRT.localScale = new Vector3(1, 0, 1);
            AsteraX.LevelInfo lvlInfo = AsteraX.GetLevelInfo();
            infoText.text  = "Asteroids: " + lvlInfo.numInitialAsteroids + "\tChildren: " + lvlInfo.numSubAsteroids;
            infoText.color = Color.clear;
            // Set initial state
            img.color          = Color.clear;
            levelRT.localScale = new Vector3(1, 0, 1);
            infoText.color     = Color.clear;
            // Set timiing and advancement
            stateDuration = fadeTime * 0.2f;
            nextState     = eLevelAdvanceState.fadeIn2;
            break;

        case eLevelAdvanceState.fadeIn2:
            // Set initial state
            img.color          = Color.black;
            levelRT.localScale = new Vector3(1, 0, 1);
            infoText.color     = Color.clear;
            // Set timiing and advancement
            stateDuration = fadeTime * 0.6f;
            nextState     = eLevelAdvanceState.fadeIn3;
            break;

        case eLevelAdvanceState.fadeIn3:
            // Set initial state
            img.color          = Color.black;
            levelRT.localScale = new Vector3(1, 1, 1);
            infoText.color     = Color.clear;
            // Set timiing and advancement
            stateDuration = fadeTime * 0.2f;
            nextState     = eLevelAdvanceState.display;
            break;

        case eLevelAdvanceState.display:
            stateDuration = displayTime;
            nextState     = eLevelAdvanceState.fadeOut;
            if (displayCallback != null)
            {
                displayCallback();
                displayCallback = null;
            }
            break;

        case eLevelAdvanceState.fadeOut:
            // Set initial state
            img.color          = Color.black;
            levelRT.localScale = new Vector3(1, 1, 1);
            infoText.color     = Color.white;
            // Set timiing and advancement
            stateDuration = fadeTime * 0.2f;
            nextState     = eLevelAdvanceState.fadeOut2;
            break;

        case eLevelAdvanceState.fadeOut2:
            // Set initial state
            img.color          = Color.black;
            levelRT.localScale = new Vector3(1, 1, 1);
            infoText.color     = Color.clear;
            // Set timiing and advancement
            stateDuration = fadeTime * 0.6f;
            nextState     = eLevelAdvanceState.fadeOut3;
            break;

        case eLevelAdvanceState.fadeOut3:
            // Set initial state
            img.color          = Color.black;
            levelRT.localScale = new Vector3(1, 0, 1);
            infoText.color     = Color.clear;
            // Set timiing and advancement
            stateDuration = fadeTime * 0.2f;
            nextState     = eLevelAdvanceState.idle;
            break;
        }

        state = newState;
    }