////////////////// // Constructors // ////////////////// public Transport(TYPE transportType, EXPANSION expansion, ENHANCEMENTS enhancements, CityPart.PLACE cityPlace) { float safetyValue = Global.Values.transportSafety[(int)transportType]; float wearValue = 0f; int capacity = Global.Values.transportCapacity[(int)expansion, (int)transportType]; float maxSpeed = Global.Values.transportMaxSpeed[(int)enhancements, (int)transportType]; float speedIndexValue = 1f; float pollutingValue = Global.Values.transportPollution[(int)transportType]; SetInitialValues(transportType, safetyValue, wearValue, capacity, maxSpeed, speedIndexValue, pollutingValue, expansion, enhancements, cityPlace); }
////////////////////// // Auxiliar Methods // ////////////////////// void SetInitialValues(TYPE transportType, float safetyValue, float wearValue, int capacity, float maxSpeed, float speedIndexValue, float pollutingValue, EXPANSION expansion, ENHANCEMENTS enhancements, CityPart.PLACE cityPlace) { CityPlace = cityPlace; this.expansion = expansion; this.enhancements = enhancements; TransportType = transportType; Safety = new DependentIndex("Seguridad", "Representa como de seguro es desplazarse por " + Global.Names.transport[(int)transportType] + " en el barrio " + Global.Names.cityPart[(int)cityPlace], safetyValue); Polluting = new DependentIndex("Contaminante", "Representa como de contaminante es despalzarse por " + Global.Names.transport[(int)transportType] + " en el barrio " + Global.Names.cityPart[(int)cityPlace], pollutingValue); Wear = new DependentIndex("Desgaste", "Representa como de desgastado está el transporte por " + Global.Names.transport[(int)transportType] + " en el barrio " + Global.Names.cityPart[(int)cityPlace], wearValue); Capacity = capacity; Speed = maxSpeed; SpeedIndex = new DependentIndex("Velocidad", "Representa que cantidad de la velocidad máxima es alcanzable viajando por " + Global.Names.transport[(int)transportType] + " en el barrio " + Global.Names.cityPart[(int)cityPlace], speedIndexValue); }
public void SetExpansionState(EXPANSION newExpansionState) { this.expansion = newExpansionState; Capacity = Global.Values.transportCapacity[(int)expansion, (int)TransportType]; }