예제 #1
0
    public List <ObstructedLocation> LoadStairs(List <ObstructedLocation> obstructedLocations, float wealthLevel)
    {
        WidthStair choosenWidth = ChooseWidthStair(wealthLevel);

        // EdgeCase
        bool isLongCanBeIntegrated = !((obstructedLocations.Contains(ObstructedLocation.Short) &&
                                        obstructedLocations.Contains(ObstructedLocation.Long)) || obstructedLocations.Contains(ObstructedLocation.Corner));


        LengthStair choosenLength = ChooseLengthStair(wealthLevel, isLongCanBeIntegrated);


        WealthStair choosenWealth = ChooseWealthStair(wealthLevel);


        var idLength = GetIdLength(choosenLength);
        var idWealth = (choosenWealth == WealthStair.Poor) ? 0 : 1;

        var choosenObstructedStair = lengthStairs[idLength];
        var choosenStair           = (choosenWidth == WidthStair.Simple) ? choosenObstructedStair.simpleStairs[idWealth] : choosenObstructedStair.doubleStairs[idWealth];

        var choosenObstructedPattern = ChooseObstructedPattern(obstructedLocations, choosenObstructedStair, wealthLevel);

        bool isHub = false;

        if (!((choosenLength == LengthStair.Long && obstructedLocations.Contains(ObstructedLocation.Short)) || choosenObstructedPattern.positionStair == PositionStair.Corner))
        {
            isHub = ChooseIfHub(wealthLevel);
        }


        DirectionHub choosenDirectionHub = ChooseDirectionHub(isHub, wealthLevel);


        var profile = new StairProfile()
        {
            Stair             = choosenStair,
            ObstructedPattern = choosenObstructedPattern,
            LengthStair       = choosenLength,
            WidthStair        = choosenWidth,
            Direction         = choosenDirectionHub,
        };


        LoadStair(profile);


        obstructedLocations = obstructedLocations.Union(choosenObstructedPattern.obstructedLocations).ToList();

        return(obstructedLocations);
    }
예제 #2
0
 private float GetWidth(WidthStair widthStair)
 {
     return((widthStair == WidthStair.Simple) ? 4 : 8);
 }