private ExtBuildingManager() { ExtBuildings = new ExtBuilding[BuildingManager.MAX_BUILDING_COUNT]; for (uint i = 0; i < BuildingManager.MAX_BUILDING_COUNT; ++i) { ExtBuildings[i] = new ExtBuilding((ushort)i); } }
public void AddParkingSpaceDemand(ref ExtBuilding extBuilding, uint delta) { extBuilding.parkingSpaceDemand = (byte)Math.Min( 100, (int)extBuilding.parkingSpaceDemand + delta); RequestColorUpdate(extBuilding.buildingId); }
public void RemoveParkingSpaceDemand(ref ExtBuilding extBuilding, uint delta) { extBuilding.parkingSpaceDemand = (byte)Math.Max( 0, (int)extBuilding.parkingSpaceDemand - delta); RequestColorUpdate(extBuilding.buildingId); }
private ExtBuildingManager() { ExtBuildings = new ExtBuilding[BuildingManager.MAX_BUILDING_COUNT]; for (int buildingId = 0; buildingId < BuildingManager.MAX_BUILDING_COUNT; ++buildingId) { ExtBuildings[buildingId] = new ExtBuilding((ushort)buildingId); } }
private void RemoveDemand(ref ExtBuilding extBuilding) { RemoveParkingSpaceDemand( ref extBuilding, GlobalConfig.Instance.ParkingAI.ParkingSpaceDemandDecrement); RemovePublicTransportDemand( ref extBuilding, GlobalConfig.Instance.ParkingAI.PublicTransportDemandDecrement, true); RemovePublicTransportDemand( ref extBuilding, GlobalConfig.Instance.ParkingAI.PublicTransportDemandDecrement, false); }
public Color CustomGetColor(ushort buildingID, ref Building data, InfoManager.InfoMode infoMode) { // NON-STOCK CODE START if (Options.prohibitPocketCars) { if (infoMode == InfoManager.InfoMode.Traffic) { // parking space demand info view ExtBuilding extBuilding = ExtBuildingManager.Instance.GetExtBuilding(buildingID); return(Color.Lerp(Singleton <InfoManager> .instance.m_properties.m_modeProperties[(int)infoMode].m_targetColor, Singleton <InfoManager> .instance.m_properties.m_modeProperties[(int)infoMode].m_negativeColor, Mathf.Clamp01((float)extBuilding.ParkingSpaceDemand * 0.01f))); } else if (infoMode == InfoManager.InfoMode.Transport && !(data.Info.m_buildingAI is DepotAI)) { // public transport demand info view ExtBuilding extBuilding = ExtBuildingManager.Instance.GetExtBuilding(buildingID); return(Color.Lerp(Singleton <InfoManager> .instance.m_properties.m_modeProperties[(int)InfoManager.InfoMode.Traffic].m_targetColor, Singleton <InfoManager> .instance.m_properties.m_modeProperties[(int)InfoManager.InfoMode.Traffic].m_negativeColor, Mathf.Clamp01((float)(TrafficManagerTool.CurrentTransportDemandViewMode == TransportDemandViewMode.Outgoing ? extBuilding.OutgoingPublicTransportDemand : extBuilding.IncomingPublicTransportDemand) * 0.01f))); } } // NON-STOCK CODE END if (infoMode != InfoManager.InfoMode.None) { return(Singleton <InfoManager> .instance.m_properties.m_neutralColor); } if (!this.m_info.m_useColorVariations) { return(this.m_info.m_color0); } Randomizer randomizer = new Randomizer((int)buildingID); switch (randomizer.Int32(4u)) { case 0: return(this.m_info.m_color0); case 1: return(this.m_info.m_color1); case 2: return(this.m_info.m_color2); case 3: return(this.m_info.m_color3); default: return(this.m_info.m_color0); } }
AddPublicTransportDemand(ref ExtBuilding extBuilding, uint delta, bool outgoing) { byte oldDemand = outgoing ? extBuilding.outgoingPublicTransportDemand : extBuilding.incomingPublicTransportDemand; byte newDemand = (byte)Math.Min(100, (int)oldDemand + delta); if (outgoing) { extBuilding.outgoingPublicTransportDemand = newDemand; } else { extBuilding.incomingPublicTransportDemand = newDemand; } RequestColorUpdate(extBuilding.buildingId); }
public void ModifyParkingSpaceDemand(ref ExtBuilding extBuilding, Vector3 parkPos, int minDelta = -10, int maxDelta = 10) { Vector3 buildingPos = extBuilding.buildingId.ToBuilding().m_position; float distance = Mathf.Clamp( (parkPos - buildingPos).magnitude, 0f, GlobalConfig.Instance.ParkingAI.MaxParkedCarDistanceToBuilding); float delta = ((maxDelta - minDelta) * (distance / GlobalConfig.Instance.ParkingAI.MaxParkedCarDistanceToBuilding)) + minDelta; extBuilding.parkingSpaceDemand = (byte)Mathf.Clamp( extBuilding.parkingSpaceDemand + (int)Mathf.Round(delta), 0, 100); RequestColorUpdate(extBuilding.buildingId); }
internal void ExtSimulationStep(ushort buildingID, ref Building data, ref ExtBuilding extBuilding) { extBuilding.RemoveParkingSpaceDemand(GlobalConfig.Instance.ParkingAI.ParkingSpaceDemandDecrement); extBuilding.RemovePublicTransportDemand(GlobalConfig.Instance.ParkingAI.PublicTransportDemandDecrement, true); extBuilding.RemovePublicTransportDemand(GlobalConfig.Instance.ParkingAI.PublicTransportDemandDecrement, false); }
public void Reset(ref ExtBuilding extBuilding) { extBuilding.parkingSpaceDemand = 0; extBuilding.incomingPublicTransportDemand = 0; extBuilding.outgoingPublicTransportDemand = 0; }