Exemple #1
0
    IEnumerator _MoveToPos()
    {
        float _Dir1 = transform.position.x - StageManagerSC._LumiaInst.transform.position.x;
        int   _Dir2 = _Dir1 > 0 ? 1 : _Dir1 < 0 ? -1 : 0;

        _LSC._AutoWalk = _Dir2;
        while (0 < (transform.position.x - StageManagerSC._LumiaInst.transform.position.x) * _Dir2)
        {
            yield return(null);
        }
        _LSC._AutoWalk = 0;
        LumiaHitboxSC _LHBSC = _LSC._Hitbox.GetComponent <LumiaHitboxSC>();

        _LHBSC._HP_Current = _LHBSC._HP_Max;
        _LSC._Canvas.GetComponent <PauseSC>()._UpdateCurrentHp();
        _LSC._SavedScene = SceneManager.GetActiveScene().name;
        SysSaveSC._CharSave();
        StartCoroutine(StageManagerSC._LumiaInst.GetComponent <Lumia_SC>()._WhiteFlash());
        StageManagerSC._LumiaInst.GetComponent <SpriteRenderer>().flipX = false;
        StageManagerSC._LumiaInst.GetComponent <Animator>().SetBool("_Sitting", true);
        StageManagerSC._LSC._TemporaryFlag.Clear();

        yield return(new WaitForSeconds(1f));

        _CanStand = true;
    }
Exemple #2
0
    IEnumerator _DeathEvent()
    {
        _DeathAniPlayed = true;
        _ANI.SetBool("_Spiked", true);
        _RB.bodyType = RigidbodyType2D.Static;
        GetComponent <AudioSource>().Stop();
        _AS.PlayOneShot(_SFX[1], SysSaveSC._Vol_Master * SysSaveSC._Vol_SFX * 0.01f);
        _AS.PlayOneShot(_SFX[2], SysSaveSC._Vol_Master * SysSaveSC._Vol_SFX * 0.01f);
        GameObject _DeathImpactInst;

        _DeathImpactInst = Instantiate(_DeathImpact);
        _DeathImpactInst.transform.position = transform.position;
        yield return(new WaitForSeconds(0.3f));

        _DeathImpactInst.GetComponent <ParticleSystem>().Play();
        StageManagerSC._CamSC._CoolDownLock = true;
        StageManagerSC._CamSC._Shake(0.5f);
        yield return(new WaitForSeconds(0.2f));

        _FadeObj.SetActive(true);
        while (_FadeObj.GetComponent <CanvasGroup>().alpha < 1f)
        {
            yield return(null);
        }
        _DeathImpactInst.GetComponent <ParticleSystem>().Stop();
        StageManagerSC._CamSC._CoolDownLock = false;
        yield return(new WaitForSeconds(1f));

        _LumiaSC._SwordList.Clear();
        _LumiaSC._SwordDistanceList.Clear();
        _LumiaSC._SwordStock = _LumiaSC._SwordMax;
        AsyncOperation op = SceneManager.LoadSceneAsync(_LumiaSC._SavedScene);

        op.allowSceneActivation = false;
        DontDestroyOnLoad(transform.parent);
        while (op.progress < 0.9f)
        {
            yield return(null);
        }
        op.allowSceneActivation = true;
        GetComponent <AudioSource>().Play();
        _HP_Current = _HP_Max;
        _Canvas.GetComponent <PauseSC>()._UpdateCurrentHp();
        _LumiaSC._SwordStock = _LumiaSC._SwordMax;
        _Canvas.GetComponent <PauseSC>()._UpdateSwordCurrent();
        _ANI.SetBool("_Spiked", false);
        _ANI.SetTrigger("_AfterSpike");
        _RB.bodyType = RigidbodyType2D.Dynamic;
        StageManagerSC._LSC._ChairRespawn = true;
        SysSaveSC._CharSave();
    }