Esempio n. 1
0
        private void AddIngredient(Ingredient ingredient)
        {
            var last          = _sprites.Last.Value.transform;
            var localPosition = last.localPosition;

            last.localPosition = new Vector2(localPosition.x, localPosition.y + Speed);

            Cocktail.AddIngredient(ingredient.key);
        }
Esempio n. 2
0
 static void UiGetCocktailGlass(Cocktail cocktail)
 {
     string[] glassTypes = Enum.GetNames(typeof(GlassType));
     for (int i = 0; i < glassTypes.Length; i++)
     {
         Console.WriteLine($" {i}. {glassTypes[i]}");
     }
     Console.WriteLine("\r\nGlass type:");
     cocktail.GlassType = ConvertToGlassType(int.Parse(Console.ReadLine()));
 }
Esempio n. 3
0
        static void UiGetCocktailNameInput(Cocktail cocktail)
        {
            Console.Write("Name of drink: ");
            cocktail.Name = Console.ReadLine();

            if (string.IsNullOrEmpty(cocktail.Name))
            {
                throw new Exception("Name is empty");
            }
        }
Esempio n. 4
0
        static void UiShowCocktailDetailed(Cocktail cocktail)
        {
            Console.WriteLine("Cocktail: " + cocktail.Name);
            Console.WriteLine("Glass used: " + cocktail.GlassType);
            Console.WriteLine("Ingredients:");

            foreach (Ingredient ingredient in cocktail.IngredientDescription)
            {
                Console.WriteLine("  - " + ingredient.Food + " : " + ingredient.Description);
            }

            Console.WriteLine();
        }
Esempio n. 5
0
        // TODO : Think about making it inside drag and drop and not collision
        private void OnCollisionEnter2D(Collision2D collision)
        {
            var go         = collision.gameObject;
            var consumable = go.GetComponent <Consumable>();

            if (consumable == null)
            {
                return;
            }

            go.transform.SetParent(transform);
            Destroy(go.GetComponent <Rigidbody2D>());
            Cocktail.AddIngredient(consumable.ingredient.key);
        }
Esempio n. 6
0
        private void AddIngredient(IngredientKey ingredientKey)
        {
            if (IsFull())
            {
                PlayFull();
                return;
            }

            var currentPosition = LineRenderers.Last.Value.GetPosition(1);
            var stepPosition    = Vector3.up * 0.1f;

            LineRenderers.Last.Value.SetPosition(1, currentPosition + stepPosition);
            Cocktail.AddIngredient(ingredientKey);
        }
Esempio n. 7
0
        static void UiCreateCocktail()
        {
            Cocktail cocktail = new Cocktail();

            Console.Clear();

            try
            {
                UiGetCocktailNameInput(cocktail);
                UiGetCocktailGlass(cocktail);
                UiGetIngredientDescriptions(cocktail);

                cocktailController.Create(cocktail);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cocktail was not created: " + ex.Message);
            }
            finally
            {
                UiPressAnyKeyToLeave();
            }
        }
Esempio n. 8
0
        static void UiGetIngredientDescriptions(Cocktail cocktail)
        {
            List <Food> ingredients = ingredientController.GetAll();

            for (int i = 0; i < ingredients.Count; i++)
            {
                Console.WriteLine($" {i}. {ingredients[i].Name} : {ingredients[i].FoodType.ToString()}");
            }
            Console.WriteLine("\r\nIngredient:");
            int choice = int.Parse(Console.ReadLine());

            Console.WriteLine("\r\nDescription:");
            string decscription = Console.ReadLine();

            cocktail.IngredientDescription.Add(new Ingredient(ingredients[choice].Name, decscription));

            Console.WriteLine("Do you want more ingredients, type 'Y' ");
            ConsoleKeyInfo key = Console.ReadKey();

            if (key.Key == ConsoleKey.Y)
            {
                UiGetIngredientDescriptions(cocktail);
            }
        }