Exemplo n.º 1
0
    IEnumerator OnHalfHP()
    {
        _secondPhase = true;
        BossBehavior myBehavior = GetComponent <BossBehavior>();

        myBehavior.GoToPhaseTwo();
        // other effects
        _cameraManager.CameraShake(0.1f, _secondPhaseExplosionDuration, false);
        yield return(MiniExplosionsRoutine(_phaseOneHitboxes, _secondPhaseExplosionDuration));

        // big explosions
        for (int index = 0; index < _phaseExplosionPoints.childCount; index++)
        {
            Vector3 explodePosition = _phaseExplosionPoints.GetChild(index).position;
            Instantiate(_explosion, explodePosition, Quaternion.identity);
        }
        //change sprite after a short time
        yield return(new WaitForSeconds(0.3f));

        _allPhaseOneObjects.SetActive(false);
        SpriteRenderer myRenderer = GetComponent <SpriteRenderer>();

        myRenderer.sprite = _secondPhaseSprite;
    }