예제 #1
0
        public Template Pick(Random random)
        {
            WeightedList <Template> templates = new WeightedList <Template>();

            foreach (var template in Template.Puzzles[Tag])
            {
                templates.Add(template, template.Weight);
            }
            return(templates.GetWeighted(random));
        }
예제 #2
0
        public void PrintBackground(int id, Map map, int x, int y, Random random)
        {
            WeightedList <TileBG> RandomBricks = new WeightedList <TileBG>();

            RandomBricks.Add(TileBG.Brick, 80);
            RandomBricks.Add(TileBG.BrickMiss1, 30);
            RandomBricks.Add(TileBG.BrickMiss2, 15);

            switch (id)
            {
            default:
                map.Background[x, y] = TileBG.Empty;
                break;

            case (0):
                map.Background[x, y] = TileBG.Brick;
                break;

            case (1):
                map.Background[x, y] = TileBG.Tile4;
                break;

            case (2):
                map.Background[x, y] = TileBG.TileDetail;
                break;

            case (3):
                map.Background[x, y] = TileBG.Statue;
                break;

            case (4):
                map.Background[x, y] = TileBG.BrickMiss1;
                break;

            case (5):
                map.Background[x, y] = TileBG.BrickMiss2;
                break;

            case (6):
                map.Background[x, y] = TileBG.BrickOpening;
                break;

            case (7):
                map.Background[x, y] = RandomBricks.GetWeighted(random);
                break;

            case (8):
                map.Background[x, y] = TileBG.RailLeft;
                break;

            case (9):
                map.Background[x, y] = TileBG.RailMiddle;
                break;

            case (10):
                map.Background[x, y] = TileBG.RailRight;
                break;

            case (11):
                map.Background[x, y] = TileBG.PillarTop;
                break;

            case (12):
                map.Background[x, y] = TileBG.BrickPlatform;
                break;

            case (13):
                map.Background[x, y] = TileBG.Black;
                break;

            case (14):
                map.Background[x, y] = TileBG.BrickHole;
                break;

            case (16):
                map.Background[x, y] = TileBG.Window;
                break;

            case (17):
                map.Background[x, y] = TileBG.WindowBigLeft;
                break;

            case (18):
                map.Background[x, y] = TileBG.WindowBigRight;
                break;

            case (19):
                map.Background[x, y] = TileBG.PillarDetail;
                break;

            case (27):
                map.Background[x, y] = TileBG.Pillar;
                break;

            case (35):
                map.Background[x, y] = TileBG.PillarBottomBroken;
                break;

            case (63):     //Keep as is
                break;
            }
        }