////////////////////// // Auxiliar Methods // ////////////////////// void SetInitialValues(PLACE leisurePlace, LeisureSchedule schedule, float satisfactionValue, int cost, AVAILABILITY availability, CityPart.PLACE cityPlace) { Cost = cost; LeisurePlace = leisurePlace; Schedule = schedule; this.availability = availability; LeisurePlace = leisurePlace; switch (leisurePlace) { case PLACE.CINEMA: LeisureType = TYPE.SHOW; break; case PLACE.PARK: LeisureType = TYPE.CALM; break; case PLACE.GYM: LeisureType = TYPE.SPORT; break; case PLACE.DISCO: LeisureType = TYPE.PARTY; break; default: LeisureType = TYPE.CALM; break; } this.availability = availability; Satisfaction = new ConditionableIndex("Satisfacción", "Representa como de satisfactorio es ir a " + Global.Names.leisurePlaces[(int)leisurePlace] + " en el barrio " + Global.Names.cityPart[(int)cityPlace], satisfactionValue); CityPlace = cityPlace; }
//////////////////// // Public Methods // //////////////////// public void SetAvailability(AVAILABILITY newAvailability) { this.availability = newAvailability; Schedule = new LeisureSchedule(Global.Values.leisureOpening[(int)LeisurePlace], Global.Values.leisureOpenedTime[(int)availability, (int)LeisurePlace], Global.Values.leisureTime[(int)LeisurePlace]); }
////////////////// // Constructors // ////////////////// public Leisure(PLACE leisurePlace, AVAILABILITY availability, CityPart.PLACE cityPlace) { LeisureSchedule newSchedule = new LeisureSchedule(Global.Values.leisureOpening[(int)leisurePlace], Global.Values.leisureOpenedTime[(int)availability, (int)leisurePlace], Global.Values.leisureTime[(int)leisurePlace]); float satisfactionValue = Global.Values.leisureSatisfaction[(int)leisurePlace]; int cost = Global.Values.leisureCost[(int)leisurePlace]; SetInitialValues(leisurePlace, newSchedule, satisfactionValue, cost, availability, cityPlace); }