예제 #1
0
    ////////////////////////
    /// Auxiliar Methods ///
    ////////////////////////


    //////////////////////
    /// Public Methods ///
    //////////////////////

    public LeisurePlan GetMostSatisfyingPlan(Citizen.NATURE nature, int currentHour, int limitHour)
    {
        LeisurePlan mostSatisfying = GetNullPlan();
        int         iteration      = 0;

        foreach (Leisure l in LeisureVenues)
        {
            if (iteration++ < 1)
            {
                continue;
            }
            if (limitHour < currentHour)
            {
                limitHour += 24;
            }
            int closing = l.Schedule.Closing, openinng = l.Schedule.Opening;
            if (closing < openinng)
            {
                closing += 24;
            }
            int entering;
            if (currentHour > openinng)
            {
                if (currentHour < closing)
                {
                    entering = currentHour;
                }
                else
                {
                    entering = openinng;
                }
            }
            else
            {
                entering = openinng;
            }
            float satisfactionValue = l.Satisfaction.Value;
            if (nature == Leisure.typeToNatureMatching[(int)l.LeisureType])
            {
                satisfactionValue += Global.Values.matchingNatureBonues;
            }
            if (satisfactionValue > mostSatisfying.Satisfaction &&          // If... it's more satisfying than the current option
                entering + l.Schedule.RequieredTime <= closing &&           // ... it's possible to do the activity before the closing
                entering + l.Schedule.RequieredTime <= limitHour)           // ... it's possible to do the activity before it's too late
            {
                mostSatisfying.Enter        = entering;
                mostSatisfying.Place        = l.LeisurePlace;
                mostSatisfying.Satisfaction = satisfactionValue;
                mostSatisfying.TimeExpended = l.Schedule.RequieredTime;
                mostSatisfying.Cost         = l.Cost;
            }
        }
        return(mostSatisfying);
    }
예제 #2
0
    public LeisurePlan GetCheapestPlan(Citizen.NATURE nature, int currentHour, int limitHour)
    {
        LeisurePlan cheapest  = GetNullPlan();
        int         iteration = 0;

        foreach (Leisure l in LeisureVenues)
        {
            if (iteration++ < 1)
            {
                continue;
            }
            if (limitHour < currentHour)
            {
                limitHour += 24;
            }
            int closing = l.Schedule.Closing, openinng = l.Schedule.Opening;
            if (closing < openinng)
            {
                closing += 24;
            }
            int entering;
            if (currentHour > openinng)
            {
                if (currentHour < closing)
                {
                    entering = currentHour;
                }
                else
                {
                    entering = openinng;
                }
            }
            else
            {
                entering = openinng;
            }
            if (cheapest.Cost < cheapest.Cost &&
                entering + l.Schedule.RequieredTime <= closing &&
                entering + l.Schedule.RequieredTime <= limitHour)
            {
                float satisfactionValue = l.Satisfaction.Value;
                if (nature == Leisure.typeToNatureMatching[(int)l.LeisureType])
                {
                    satisfactionValue += Global.Values.matchingNatureBonues;
                }
                cheapest.Enter        = entering;
                cheapest.Place        = l.LeisurePlace;
                cheapest.Satisfaction = satisfactionValue;
                cheapest.TimeExpended = l.Schedule.RequieredTime;
                cheapest.Cost         = l.Cost;
            }
        }
        return(cheapest);
    }
예제 #3
0
파일: CityPart.cs 프로젝트: Phireh/VEUS
    public int CountNatureCitizens(Citizen.NATURE nature)
    {
        switch (nature)
        {
        case Citizen.NATURE.ACTIVE: return(activeNatureCitizens);

        case Citizen.NATURE.CALM: return(calmNatureCitizens);

        case Citizen.NATURE.DREAMER: return(dreamerNatureCitizens);

        case Citizen.NATURE.SOCIAL: return(socialNatureCitizens);

        default: return(-1);
        }
    }
예제 #4
0
 public static int GetCitizensNatureCount(CityPart.PLACE cityPlace, Citizen.NATURE n)
 => City.CityParts[(int)cityPlace].CountNatureCitizens(n);