// Update is called once per frame void Update() { Age(); if (fishInProgress) { fishProgress += (Time.deltaTime / fishProcessingTime); } if (clothInProgress) { clothProgress += (Time.deltaTime / clothProcessingTime); } if (schnappsInProgress) { schnappsProgress += (Time.deltaTime / schnappsProcessingTime); } if (fishProgress >= 1f) { fishInProgress = false; fishProgress = 0f; } if (clothProgress >= 1f) { clothInProgress = false; clothProgress = 0f; } if (schnappsProgress >= 1f) { schnappsInProgress = false; schnappsProgress = 0f; } if (!fishInProgress && _ressourceManager.isAvailable((int)Ressources.Fish, 1)) { _ressourceManager.Consume((int)Ressources.Fish, 1); fishInProgress = true; } if (!clothInProgress && _ressourceManager.isAvailable((int)Ressources.Cloth, 1)) { _ressourceManager.Consume((int)Ressources.Cloth, 1); clothInProgress = true; } if (!schnappsInProgress && _ressourceManager.isAvailable((int)Ressources.Schnapps, 1)) { _ressourceManager.Consume((int)Ressources.Schnapps, 1); schnappsInProgress = true; } float totalValue = fishValue + clothValue + schnappsValue; float _happiness = (fishValue * Convert.ToInt32(fishInProgress) / totalValue) + (clothValue * Convert.ToInt32(clothInProgress) / totalValue) + (schnappsValue * Convert.ToInt32(schnappsInProgress) / totalValue); happiness = _happiness; commute(); }