Ejemplo n.º 1
0
    //=====================================================

    public void OnBossDeadEvent()
    {
        _isPlayerDead = false;

        if (BossManager.Instance == null || BossManager.Instance.CutsceneBossLoses == null)
        {
            return;
        }

        _isLeavingBossRoom = true;

        SetNextLocation(eLocation.MAIN_HALL);

        // Play cutscene
        if (BossLosesEvent != null)
        {
            BossLosesEvent(BossManager.Instance.CutsceneBossLoses);
        }

        // Apply wild magic bonus
        if (PlayerPrefsWrapper.HasKey("FirstBossKill") == false || PlayerPrefsWrapper.GetInt("FirstBossKill") != 1)
        {
            PlayerPrefsWrapper.SetInt("FirstBossKill", 1);

            GameDataManager.Instance.AddWildMagicAndPopulation(
                WildMagicItemsManager.GetWildMagicItem("WM_RATE_BOSS_FIGHT_WIN_FIRST"));
        }
        else
        {
            GameDataManager.Instance.AddWildMagicAndPopulation(
                WildMagicItemsManager.GetWildMagicItem("WM_RATE_BOSS_FIGHT_WIN_DEFAULT"));
        }

        // Increment boss level
        if (GameDataManager.Instance.PlayerBossLevel < GameDataManager.Instance.PlayerMaxFairyLevel)
        {
            GameDataManager.Instance.PlayerBossLevel += 1;
        }

        // If boss is at level 3 then start timer intervals between boss appearances
        // Note: time-interval-start checked by boss door on entering MainHall scene
        if (GameDataManager.Instance.PlayerBossLevel >= GameDataManager.Instance.PlayerMaxFairyLevel)
        {
            PlayerPrefsWrapper.SetDouble("BossRoomTimedIntervalStarted", PreHelpers.UnixUtcNow());
        }
    }