Beispiel #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);
    }
Beispiel #2
0
    private float GetLength(LengthStair lengthStair)
    {
        switch (lengthStair)
        {
        case LengthStair.Long:
            return(54.4f);

        case LengthStair.Medium:
            return(31.2f);

        case LengthStair.Short:
            return(19.6f);
        }

        return(0);
    }
Beispiel #3
0
    private int GetIdLength(LengthStair lengthStair)
    {
        switch (lengthStair)
        {
        case LengthStair.Long:
            return(0);

        case LengthStair.Medium:
            return(1);

        case LengthStair.Short:
            return(2);
        }

        return(2);
    }