示例#1
0
 public override void EndTaking()
 {
     if (curLevel != -1)
     {
         currentPool.EndTaking();
     }
 }
示例#2
0
    protected bool ApplyMod <T>(RoomSpec spec, ProbabilityPool <T> mods)
        where T : RoomModifier
    {
        mods.BeginTaking();
        T mod;

        while (mods.Take(spec.Random, out mod))
        {
            #region DEBUG
            float stepTime = 0;
            if (BigBoss.Debug.logging(Logs.LevelGenMain))
            {
                BigBoss.Debug.w(Logs.LevelGenMain, "   Applying: " + mod);
            }
            if (BigBoss.Debug.logging(Logs.LevelGen))
            {
                stepTime = Time.realtimeSinceStartup;
                BigBoss.Debug.w(Logs.LevelGen, "Applying: " + mod);
            }
            #endregion
            Container2D <GenSpace> backupGrid = new MultiMap <GenSpace>(spec.Grids);
            if (mod.Modify(spec))
            {
                #region DEBUG
                if (BigBoss.Debug.logging(Logs.LevelGen))
                {
                    spec.Grids.ToLog(Logs.LevelGen, "Applying " + mod + " took " + (Time.realtimeSinceStartup - stepTime) + " seconds.");
                }
                #endregion
                mods.EndTaking();
                return(true);
            }
            else
            {
                spec.Grids = backupGrid;
                #region DEBUG
                if (BigBoss.Debug.logging(Logs.LevelGen))
                {
                    spec.Grids.ToLog(Logs.LevelGen, "Couldn't apply mod.  Processing " + mod + " took " + (Time.realtimeSinceStartup - stepTime) + " seconds.");
                }
                #endregion
            }
        }
        mods.EndTaking();
        return(false);
    }
 public override void EndTaking()
 {
     _pool.EndTaking();
 }