private void ApplyEffect()
 {
     if (mEffect == "shuffle_matches")
     {
         Game.instance.companionBuilder.BuildCompanionSet();
         QuestR.seenMatches = false;
     }
     else if (mEffect == "random_item")
     {
         StartCoroutine(GiveRandomItemCoroutine());
     }
     else if (mEffect == "effect_bruiser")
     {
         GameObject newItem = GameObject.Instantiate(PrefabManager.instance.PrefabByName("DifficultyBoost"));
         newItem.GetComponentInChildren <Item>().Equip();
         DifficultyBoost.Reset();
     }
 }
Example #2
0
    private IEnumerator Start()
    {
        mDungeonGenerator = new RandomDungeonGenerator();

        TextAsset roomSetData = Resources.Load <TextAsset>("RoomSets/" + CurrentDungeonFloorData().roomSet);

        mRoomset = new RoomSet();
        mRoomset.LoadFromTextAsset(roomSetData);

        mDungeon = mDungeonGenerator.GenerateDungeon(mRoomset, DungeonGenerationData());

        mKillableMap = GetComponent <KillableMap>();
        mKillableMap.SetupWithDungeon(mDungeon);

        mCollisionMap = GetComponent <CollisionMap>();
        mCollisionMap.SetupWithSize(mDungeon.width, mDungeon.height);
        GenerateEnvironmentFromDungeon(mDungeon);

        PlaceAvatar();

        // Provide some time after the avatar is generated for any of its setup (ie: quirk setup)
        // to impact dungeon generation
        yield return(null);

        // Special handling for the 'difficulty boost' effect
        DifficultyBoost db = GameObject.FindObjectOfType <DifficultyBoost>();

        if (db != null)
        {
            db.ApplyQuirks();
            yield return(null);
        }

        yield return(null);

        if (!IsPresetRoom())
        {
            PlaceDeadEndInterests();
        }

        PlaceTraps();
        PlaceEnemies();

        if (!IsPresetRoom())
        {
            PlaceHearts();
            PlaceExit();
            QuirkSpecificSpawns();
        }

        if (Game.instance.currentDungeonFloor == 5)
        {
            Game.instance.soundManager.PlayRandomMusicInCategory("BossMusic");
        }
        else if (Game.instance.quirkRegistry.IsQuirkActive <GothQuirk>())
        {
            Game.instance.soundManager.PlayRandomMusicInCategory("GothMusic");
        }
        else if (Game.instance.quirkRegistry.IsQuirkActive <OldTimeyQuirk>())
        {
            Game.instance.soundManager.PlayRandomMusicInCategory("OldTimey");
        }
        else if (Game.instance.quirkRegistry.IsQuirkActive <Cowfolk>())
        {
            Game.instance.soundManager.PlayRandomMusicInCategory("Cowboy");
        }
        else
        {
            Game.instance.soundManager.PlayRandomMusicInCategory("DungeonMusic");
        }

        Game.instance.playerData.MarkDirty();

        yield break;
    }