Beispiel #1
0
    private IEnumerator KilledCoroutine()
    {
        if (_line == 2)
        {
            CEnemyManager.Inst.stopEnemySfx();
        }

        CAudioManager.Inst.playSfx("explosion", _explosion, _deathVolume);


        SetMovementState(_STATE_DEATH);
        _anim.SetTrigger("Trigger2");
        CEnemyManager.Inst.ImOut(this);
        EyesOff();

        yield return(new WaitForSeconds(1f));

        Destroy(this.gameObject);

        CSingingStage SS = CLevelManager.Inst.getCurrentState() as CSingingStage;

        if (SS != null)
        {
            if (!(SS.tutorialEnabled))
            {
                CScoreManager.Inst.AddToScore(50);
            }
        }



        //Do something

        yield return(null);
    }
Beispiel #2
0
    public void updateBarAndClassification()
    {
        // inicio min score final max score
        CSingingStage state = CLevelManager.Inst.getCurrentState() as CSingingStage;

        if (state != null && state.tutorialEnabled)
        {
            return;
        }

        // de 0 a max score.

        // Total de enemies.
        int enemiesRemaining = mScroller._cantidadMaxSpawn - mScroller._currentCantidadSpawn + CEnemyManager.Inst.cantEnemies();

        int posibleScore = enemiesRemaining * 50;

        float val = CMath.lerp(_minScore, _maxScore, 0, 1, _score + posibleScore);

        Debug.Log("val: " + val);

        if (val <= 0)
        {
            Debug.Log("lost!");


            if (state != null)
            {
                state.notifyLoss();
            }
        }

        //  _maxScore
        _playerScore.setCurrentPercent(val);

        int clas = getClassification(val);

        if (mCurrentClassification != clas)
        {
            _scoreText.sprite = mScores[clas];

            mCurrentClassification = clas;
        }
    }
Beispiel #3
0
    private IEnumerator SpawnCoroutine()
    {
        bool spawning = true;

        _startedCoroutine = true;

        CSingingStage state = CLevelManager.Inst.getCurrentState() as CSingingStage;

        while (spawning)
        {
            if (mDeltaTime >= _songLimitTime)
            {
                spawning = false;
            }

            int ran = Random.Range(1, 4);

            if (state != null)
            {
                if (state.getState() == CSingingStage.STATE_ENDING)
                {
                    spawning = false;
                }

                if (state.tutorialEnabled)
                {
                    int currentTutorial = state.getCurrentTutorialStage();

                    if (currentTutorial == 1)
                    {
                        ran = 2;
                    }
                    else if (currentTutorial == 2)
                    {
                        ran = 1;
                    }
                    else if (currentTutorial == 3)
                    {
                        ran = 3;
                    }
                }
            }

            if (ran == 1)
            {
                SpawnEnemy(_spawn1.position + _offset, 1, 45);
            }
            else if (ran == 2)
            {
                SpawnEnemy(_spawn2.position + _offset, 2, 47);
            }
            else if (ran == 3)
            {
                SpawnEnemy(_spawn3.position + _offset, 3, 49);
            }

            _currentCantidadSpawn += +1;

            //if (_currentCantidadSpawn >= _cantidadMaxSpawn)
            //    spawning = false;

            // Hack para convocar en una sola fila comentando los if de ran.
            //SpawnEnemy(_spawn2.position + _offset, 2);

            //int tutorialMultiplayer = 1;

            //if (SS != null)
            //{
            //    if (SS.tutorialEnabled)
            //    {
            //        tutorialMultiplayer = 2;
            //    }
            //}


            //yield return new WaitForSeconds(Random.Range(_spawnMinTimer, _spawnMaxTimer) * tutorialMultiplayer);
            yield return(new WaitForSeconds(state.tutorialEnabled ? _tutorialTimer : Random.Range(_spawnMinTimer, _spawnMaxTimer)));
        }

        Debug.Log("mDeltaTime: " + mDeltaTime);


        yield return(null);
    }