static ConstructionMaterials() { Wood = new ConstructionMaterial { Key = "Wood", DisplayName = "Holz", TradeValue = 4, ProductionCost = 3.33 }; Tools = new ConstructionMaterial { Key = "Tools", DisplayName = "Werkzeug", TradeValue = 36, ProductionCost = 27.5 }; Stone = new ConstructionMaterial { Key = "Stone", DisplayName = "Steine", TradeValue = 8, ProductionCost = 10 }; Glass = new ConstructionMaterial { Key = "Glass", DisplayName = "Glas", TradeValue = 68, ProductionCost = 26.25 }; Mosaic = new ConstructionMaterial { Key = "Mosaic", DisplayName = "Mosaik", TradeValue = 46, ProductionCost = 32.5 }; }
public void ProduceMaterial(ResourceManager manager) { if (HasEnergy) { InternalStorage += constructionMaterialPerSecond * Time.fixedDeltaTime; InternalStorage = ResourceMath.Min(internalStorageSize, InternalStorage); Debug.Assert(internalStorageSize >= minimumDeliveryAmount, "Quarry internal storage is not big enough"); Debug.Assert(minimumDeliveryAmount > ConstructionMaterial.Zero, "Delivery amount has to be bigger than 0"); while (InternalStorage >= minimumDeliveryAmount) { manager.Store(minimumDeliveryAmount); InternalStorage -= minimumDeliveryAmount; var fadeout = Instantiate(fadeoutTextPrefab, transform); fadeout.TextMesh.text = $"+{(float)minimumDeliveryAmount:F0}"; fadeout.TextMesh.color = new Color(1f, 0.5f, 0.15f, 1); audioSource.Play(); } } }