Esempio n. 1
0
 private void Awake()
 {
     if (mInstance == null)
     {
         mInstance = this;
     }
 }
Esempio n. 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;
    }