diff --git a/Assets/Scenes/Noahs kælder.unity b/Assets/Scenes/Noahs kælder.unity index 7bb0a01..69f21ff 100644 --- a/Assets/Scenes/Noahs kælder.unity +++ b/Assets/Scenes/Noahs kælder.unity @@ -641,7 +641,7 @@ Transform: m_GameObject: {fileID: 537514707} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 2.04, y: -2.51, z: 0} + m_LocalPosition: {x: 0.19, y: -0.12, z: 0} m_LocalScale: {x: 2, y: 2, z: 2} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1031,7 +1031,7 @@ Transform: m_GameObject: {fileID: 885031692} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 3.06, y: -2.09, z: 0} + m_LocalPosition: {x: 2.08, y: -0.27, z: 0} m_LocalScale: {x: 2, y: 2, z: 2} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Scripts/Cooking.cs b/Assets/Scripts/Cooking.cs index 90abb21..bd1bff5 100644 --- a/Assets/Scripts/Cooking.cs +++ b/Assets/Scripts/Cooking.cs @@ -29,8 +29,9 @@ public class Cooking : MonoBehaviour } } - List PossibleDishes = new List (); + + List PossibleDishes = new List (); // Find the dishes, where all ingredients exist foreach (GameObject Dish in AllDishes) { @@ -51,11 +52,29 @@ public class Cooking : MonoBehaviour } } - foreach (GameObject Dish in PossibleDishes) { - Debug.Log(Dish); + // No dishes possible + + if (PossibleDishes.Count < 1) { + return; } - + GameObject BestDish = null; + foreach (GameObject Dish in PossibleDishes) { + + if (BestDish == null) { + BestDish = Dish; + continue; + } + + int CurrentNutritionalValue = Dish.GetComponent().NutritionalValue; + int BestNutrionnalValue = BestDish.GetComponent().NutritionalValue; + + if (CurrentNutritionalValue > BestNutrionnalValue) { + BestDish = Dish; + } + } + + Debug.Log(BestDish.name); }