Beispiel #1
0
 public bool addIngredientToCombination(IngredientType item)
 {
     // BUG: this check fails if two same typed items are added to the pool before the first item has completed its downscale animation
     if (noIngredients == 0 || (currentPool & item) != item)
     {
         currentPool |= item;
         noIngredients++;
         GameObject product;
         if (isIngredientsAProduct(currentPool, out product))
         {
             currentPool = 0;
             noIngredients = 0;
             instantiateProduct(product);
             postitwall.Clear();
             enterPoolParent.GetComponentInChildren<EnterPool>().GetComponent<MeshCollider>().enabled = true;
             this.GetComponent<AudioSource>().PlayOneShot(onCorrectCombination, 0.8f);
         }
         else if (noIngredients == 3)
         {
             currentPool = 0;
             noIngredients = 0;
             postitwall.Clear();
             Debug.LogWarning("No combination was found");
             instantiateProduct(this.getBadProduct());
             enterPoolParent.GetComponentInChildren<EnterPool>().GetComponent<MeshCollider>().enabled = true;
             this.GetComponent<AudioSource>().PlayOneShot(onIncorrectCombination[Random.Range(0, onIncorrectCombination.Length)]);
         }
         return true;
     }
     return false;
 }
 private void comport_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ComboBox cb = sender as ComboBox;
     if (cb.SelectedItem != null)
     {
         if (cb.SelectedIndex==0)
         {
             _type = IngredientType.ESPRESSO;
         }
         if (cb.SelectedIndex == 1)
         {
             _type = IngredientType.FILTERBREW;
         }
         if (cb.SelectedIndex == 2)
         {
             _type = IngredientType.INSTANTPOWDER;
         }
         if (cb.SelectedIndex == 3)
         {
             _type = IngredientType.FRESHMILK;
         }
         if (cb.SelectedIndex == 4)
         {
             _type = IngredientType.Water;
         }
     }
 }
 public CreatedPotion(Potion potion, IngredientType ingredient1, IngredientType ingredient2, IngredientType ingredient3)
 {
     this.potion = potion;
     ingredients = new List<IngredientType>();
     ingredients.Add(ingredient1);
     ingredients.Add(ingredient2);
     ingredients.Add(ingredient3);
 }
    public IngredientData(IngredientType type, Aspects.Primary primary, Aspects.Secondary secondary)
    {
        this.type = type;
        this.primary = primary;
        this.secondary = secondary;

        primaryGuesses = new Dictionary<Aspects.Primary, GuessState>();
        secondaryGuesses = new Dictionary<Aspects.Secondary, GuessState>();
    }
		/// <summary>
		/// Gets an Ingredient Name
		/// </summary>
		string GetIngredientName(IngredientType ingredientType, int ingredientId)
		{
			var ingredient = this.Ingredients.FirstOrDefault(x => x.IngredientTypeId == (int)ingredientType && x.IngredientId == ingredientId);
			if(ingredient == null)
			{
				// NOTE: This shouldn't happen ... only public ingredients allowed for Send-To-Shop
				throw new NotSupportedException("Send-To-Shop Ingredient is not a public ingredient");
			}

			return ingredient.Name;
		}
    public void throwIngredient(IngredientType type)
    {
        GameObject instantiated = Instantiate(IngredientUniversalPrefab);
        instantiated.GetComponent<Ingredient>().type = (IngredientType)type;
        instantiated.GetComponent<Ingredient>().InitializeGameObject();

        Vector3 newPosition = transform.position;
        newPosition.x += (float) (rng.NextDouble() * maxSpawnPositionOffset * 2) - maxSpawnPositionOffset;
        newPosition.y += (float) (rng.NextDouble() * maxSpawnPositionOffset * 2) - maxSpawnPositionOffset;
        instantiated.transform.position = newPosition;
        instantiated.GetComponent<Rigidbody2D>().velocity = Speed;
    }
    public IngredientType? TryPlaceIngredient(IList<float> shelfSpace, int shelfIndex)
    {
        if (shelfIndex == 0 && Random.value < SwitchProbability)
        {
            currentIngredient = selectIngredient();
        }

        if (shelfSpace[shelfIndex] > 0)
        {
            return currentIngredient;
        }
        return null;
    }
 private void btbNewIng_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(tbxIngName.Text) && string.IsNullOrWhiteSpace(tbxIngPrice.Text) && cbbxIngType.SelectedItem == null)
     {
         MessageBox.Show("Du mangler at udfylde et felt");
     }
     else
     {
         IngredientType selectedtype = (IngredientType)Enum.Parse(typeof(IngredientType), cbbxIngType.SelectedItem.ToString());
         Ingredient     ing          = new Ingredient(decimal.Parse(tbxIngPrice.Text), tbxIngName.Text, selectedtype);
         handler.MakeIngredient(ing);
         handler.GetAllIngredients();
     }
 }
        // GET: IngredientTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IngredientType ingredientType = db.IngredientTypes.Find(id);

            if (ingredientType == null)
            {
                return(HttpNotFound());
            }
            return(View(ingredientType));
        }
Beispiel #10
0
        /// <summary>
        /// Toggles On/Off the filter for the given type.
        /// </summary>
        public void ToggleFilter(IngredientType filter)
        {
            if (ActiveFilters.TryGetValue(filter, out var toggle))
            {
                ActiveFilters[filter] = !toggle;

                if (buttons.TryGetValue(filter, out var button))
                {
                    button.On = !toggle;
                }

                OnFiltersChanged?.Invoke();
            }
        }
Beispiel #11
0
    public void resetVars()
    {
        tacoOrder = false;
        chipOrder = false;
        //beanOrder = false;

        tacoTopingTotal = 0;
        tacoSlot1       = IngredientType.None;
        tacoSlot2       = IngredientType.None;
        tacoSlot3       = IngredientType.None;
        tacoSlot4       = IngredientType.None;

        chipSlot = "None";
    }
Beispiel #12
0
        public void InvalidInputStringParseFail()
        {
            // Arrange
            string         input      = "!@#$%^&";
            IngredientType ingredType = IngredientType.Produce;
            Ingredient     theIngredient;

            // Act

            theIngredient = ParseHandler.parseIngredientLine(input, ingredType);

            // Assert
            Assert.IsNull(theIngredient);
        }
        public static string ToIngredientName(IngredientType ingredientType)
        {
            switch (ingredientType)
            {
            case IngredientType.AN:
                return("Anchovy");

            case IngredientType.BA:
                return("Bacon");

            case IngredientType.CH:
                return("Cheese");

            case IngredientType.GA:
                return("Garlic");

            case IngredientType.GB:
                return("Green Peppers");

            case IngredientType.HB:
                return("Habenero");

            case IngredientType.JP:
                return("Jalapeno");

            case IngredientType.MR:
                return("Mushrooms");

            case IngredientType.OL:
                return("Olives");

            case IngredientType.ON:
                return("Onions");

            case IngredientType.PA:
                return("Pineapple");

            case IngredientType.PP:
                return("Pepperoni");

            case IngredientType.SA:
                return("Sausage");

            case IngredientType.TM:
                return("Tomatoes");

            default:
                return(null);
            }
        }
Beispiel #14
0
 public bool Delete(int ingredientTypeID)
 {
     try
     {
         IngredientType obj = ingredientTypes.SingleOrDefault(x => x.IngredientTypeID == ingredientTypeID);
         obj.Status = false;
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #15
0
        private void SetUp(IngredientType ingType)
        {
            tbName.Text = ingType.name;

            if (ingType.GetType().Name == "CookingDependentType")
            {
                tbAdditional.Text  = ((CookingDependentType)ingType).additionalCalories.ToString();
                tbCookingType.Text = ((CookingDependentType)ingType).cookingType.ToString();
            }
            else if (ingType.GetType().Name == "TemperatureDependentType")
            {
                tbAdditional.Text = ((TemperatureDependentType)ingType).additionalPerTenDegrees.ToString();
            }
        }
Beispiel #16
0
    public void throwIngredient(IngredientType type)
    {
        GameObject instantiated = Instantiate(IngredientUniversalPrefab);

        instantiated.GetComponent <Ingredient>().type = (IngredientType)type;
        instantiated.GetComponent <Ingredient>().InitializeGameObject();

        Vector3 newPosition = transform.position;

        newPosition.x += (float)(rng.NextDouble() * maxSpawnPositionOffset * 2) - maxSpawnPositionOffset;
        newPosition.y += (float)(rng.NextDouble() * maxSpawnPositionOffset * 2) - maxSpawnPositionOffset;
        instantiated.transform.position = newPosition;
        instantiated.GetComponent <Rigidbody2D>().velocity = Speed;
    }
Beispiel #17
0
 public void Name_property_Test(string input, bool type)
 {
     if (!type)
     {
         Assert.Throws <ArgumentException>(() => new IngredientType {
             Name = input
         });
     }
     else
     {
         IngredientType test = new IngredientType();
         test.Name = input;
         Assert.Equal(input, test.Name);
     }
 }
Beispiel #18
0
 public void Id_property_Test(int input, bool type)
 {
     if (!type)
     {
         Assert.Throws <ArgumentException>(() => new IngredientType {
             Id = input
         });
     }
     else
     {
         IngredientType test = new IngredientType();
         test.Id = input;
         Assert.Equal(input, test.Id);
     }
 }
        public ActionResult ConfirmDelete(string Id)
        {
            IngredientType ingredientTypeToDelete = context.Find(Id);

            if (ingredientTypeToDelete == null) //if not found
            {
                return(HttpNotFound());         //issue an http error
            }
            else
            {
                context.Delete(Id); //deletes from database
                context.Commit();   //saves changes
                return(RedirectToAction("Index"));
            }
        }
Beispiel #20
0
 public bool Edit(IngredientType entity)
 {
     try
     {
         IngredientType obj = ingredientTypes.SingleOrDefault(x => x.IngredientTypeID == entity.IngredientTypeID);
         obj.Name   = entity.Name;
         obj.Status = entity.Status;
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public ActionResult Create(IngredientType ingredientType)
        {
            //check if data validation passed
            if (!ModelState.IsValid)
            {
                return(View(ingredientType));//returns if data validation is unsuccessful
            }
            else
            {
                context.Insert(ingredientType);    //adds the recipe
                context.Commit();                  //saves changes to cache memory

                return(RedirectToAction("Index")); //redirects to index page
            }
        }
Beispiel #22
0
        public List <Ingredient> CreateIngredientsFromDataSet(DataSet data)
        {
            List <Ingredient> ingredients = new List <Ingredient>();

            foreach (DataRow row in data.Tables[0].Rows)
            {
                decimal        price      = row.Field <decimal>("Price");
                string         name       = row.Field <string>("Name");
                string         typeString = row.Field <string>("Type");
                IngredientType type       = (IngredientType)Enum.Parse(typeof(IngredientType), typeString);
                int            id         = row.Field <int>("ID");
                ingredients.Add(new Ingredient(price, name, type, id));
            }
            return(ingredients);
        }
Beispiel #23
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            IngredientType = await _context.IngredientType.FirstOrDefaultAsync(m => m.Id == id);

            if (IngredientType == null)
            {
                return(NotFound());
            }
            return(Page());
        }
    public static Aspects.Primary GetPrimaryAspect(this IngredientType ingredient)
    {
        switch (ingredient)
        {
        case IngredientType.CHEDDAR:
        case IngredientType.SWISS:
        case IngredientType.ICE_CREAM:
        case IngredientType.PEPPER_JACK:
        case IngredientType.MILK:
        case IngredientType.YOGURT:
        case IngredientType.STINKY_CHEESE:
        case IngredientType.GREEN_CHEESE:
            return(Aspects.Primary.DAIRY);

        case IngredientType.LETTUCE:
        case IngredientType.BELL_PEPPER:
        case IngredientType.PEACH:
        case IngredientType.HABANERO:
        case IngredientType.APPLE:
        case IngredientType.MUSHY_PEAS:
        case IngredientType.MUSHROOMS:
        case IngredientType.TOMATO:
            return(Aspects.Primary.PLANT);

        case IngredientType.BEEF:
        case IngredientType.TOFU:
        case IngredientType.BACON:
        case IngredientType.FRIED_CHICKEN:
        case IngredientType.FISH:
        case IngredientType.CALAMARI:
        case IngredientType.SPOILED_MEAT:
        case IngredientType.RAW_MEAT:
            return(Aspects.Primary.MEAT);

        case IngredientType.WHITE_BREAD:
        case IngredientType.NAAN:
        case IngredientType.DONUT:
        case IngredientType.TOASTED_BREAD:
        case IngredientType.RICE:
        case IngredientType.SPAGHETTI:
        case IngredientType.BEER:
        case IngredientType.DOG_BISCUIT:
            return(Aspects.Primary.GRAIN);

        default:
            throw new ArgumentException("Unrecognized IngredientType: " + ingredient);
        }
    }
Beispiel #25
0
 public void ChooseIngredient()
 {
     if (ingredientsInScene.Count > 0)
     {
         int index = Random.Range(0, ingredientsInScene.Count);
         wantedIngredient = ingredientsInScene[index].type;
         wantedSign.GetComponent <SpriteRenderer>().sprite = possibleIngredients[(int)wantedIngredient];
         thinking = false;
     }
     else
     {
         //won scene
         wantedSign.SetActive(false);
         Debug.Log("won scene");
     }
 }
        public async Task Return_Correct_Updated_Ingredient()
        {
            var options = Utils.GetOptions(nameof(Return_Correct_Updated_Ingredient));

            var ingredient = new Ingredient
            {
                Id          = Guid.Parse("4039e0f3-8d2d-43a5-a82b-477e42371cd6"),
                Name        = "Martini Extra Dry",
                Abv         = 0,
                Description = "",
                TypeId      = Guid.Parse("619ac43c-075a-47be-befc-c68249054b85"),
                Type        = new IngredientType
                {
                    Id   = Guid.Parse("619ac43c-075a-47be-befc-c68249054b85"),
                    Name = "Rum"
                }
            };

            var ingredientType = new IngredientType()
            {
                Id   = Guid.Parse("4a399308-dec0-4161-a679-18b4898c7e4b"),
                Name = "Liqeur"
            };

            using (var arrangeContext = new CMContext(options))
            {
                arrangeContext.Ingredients.Add(ingredient);
                arrangeContext.IngredientTypes.Add(ingredientType);
                arrangeContext.SaveChanges();
            }

            var newName  = "Water";
            var newAbv   = 15;
            var newDescr = "Top";

            using (var assertContext = new CMContext(options))
            {
                var sut    = new IngredientService(assertContext);
                var result = await sut.UpdateIngredient(ingredient.Id, newName, newAbv, newDescr, ingredientType.Id);

                Assert.AreEqual(ingredient.Id, result.Id);
                Assert.AreEqual(newName, result.Name);
                Assert.AreEqual(newDescr, result.Description);
                Assert.AreEqual(newAbv, result.Abv);
                Assert.AreEqual(ingredientType.Id, result.TypeId);
            }
        }
Beispiel #27
0
        public IIngredient GetIngredient(IngredientType ingredientType)
        {
            switch (ingredientType)
            {
            case IngredientType.Fermentable:
                return(new Fermentable());

            case IngredientType.BitterSeason:
                return(new Hops());

            case IngredientType.Fermenter:
                return(new Yeast());

            default:
                throw new NotImplementedException("need to finish implementing ingredients");
            }
        }
        private void BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            string         updatedName  = TxtBoxIngredientName.Text;
            decimal        updatedPrice = decimal.Parse(TxtBoxIngredientPrice.Text);
            IngredientType updatedType  = (IngredientType)CmbBoxIngredientTypes.SelectedItem;

            try
            {
                Ingredient updatedIngredient = new Ingredient(updatedPrice, updatedName, updatedType, oldIngredient.id);
                handler.UpdateIngredient(updatedIngredient);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"An error has occured.{Environment.NewLine}{Environment.NewLine}{ex.Message}");
            }
        }
Beispiel #29
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            IngredientType = await _context.IngredientType.FindAsync(id);

            if (IngredientType != null)
            {
                _context.IngredientType.Remove(IngredientType);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #30
0
 public void addIngredientType(IngredientType ingredientType)
 {
     for (int i = 0; i < list.Count(); i++)
     {
         if (listLabels[i].Equals(ingredientType.CrepeCategory))
         {
             list[i].Add(new SelectListItem {
                 Text = ingredientType.Type, Value = ingredientType.Type
             });
             return;
         }
     }
     list.Add(new List <SelectListItem>());
     listLabels.Add(ingredientType.CrepeCategory);
     list.Last().Add(new SelectListItem {
         Text = ingredientType.Type, Value = ingredientType.Type
     });
 }
Beispiel #31
0
        public void ValidIngredientStringParseSuccess()
        {
            // Arrange
            string         input      = "- 1 clove of organic garlic = $0.67";
            IngredientType ingredType = IngredientType.Produce;
            Ingredient     theIngredient;

            // Act

            theIngredient = ParseHandler.parseIngredientLine(input, ingredType);

            // Assert
            Assert.IsNotNull(theIngredient);
            Assert.IsTrue(theIngredient.getIsOrganic());
            Assert.IsTrue(theIngredient.getIsProduce());
            Assert.AreEqual(theIngredient.getName(), "garlic");
            Assert.AreEqual(theIngredient.getCost(), 0.67m);
        }
Beispiel #32
0
        public void ValidIngredientStringParseSuccessPantry()
        {
            // Arrange
            string         input      = "- 1 teaspoon of salt = $0.16";
            IngredientType ingredType = IngredientType.Pantry;
            Ingredient     theIngredient;

            // Act

            theIngredient = ParseHandler.parseIngredientLine(input, ingredType);

            // Assert
            Assert.IsNotNull(theIngredient);
            Assert.IsFalse(theIngredient.getIsOrganic());
            Assert.IsFalse(theIngredient.getIsProduce());
            Assert.AreEqual(theIngredient.getName(), "salt");
            Assert.AreEqual(theIngredient.getCost(), 0.16m);
        }
    private void handlePlayerIngredientCollision(Ingredient collidedIngredient)
    {
        IngredientType ingredientType = collidedIngredient.ingredientType;

        acquiredIngredientTypes[ingredientType] = true;

        //TODO have OPTION to swap between FlatHUD or Phonehud here
        //canvasController.ActivateScoringIcon(ingredientType);
        flatHUDController.ActivateIngredientModel(ingredientType);

        bwipSound.Play();

        //TODO maybe move this to CanvasController?
        string scoreText = string.Format("+{0}", collidedIngredient.pointAward);

        canvasController.FlashScoreAlert(scoreText, Color.white);
        StartCoroutine(delayedCheckIfAllIngredientsAcquired());
    }
        public async Task AddIngredientAsync(Ingredient ingredient)
        {
            IngredientType newIngredientType = (await GetIngredientTypesAsync(name: ingredient.IngredientType.Name)).FirstOrDefault();

            if (newIngredientType == null)
            {
                ingredient.IngredientType.Id = 0;
                await AddIngredientTypeAsync(ingredient.IngredientType);
            }

            Ingredient newIngredient = (await GetIngredientsAsync(name: ingredient.Name)).FirstOrDefault();

            if (newIngredient == null)
            {
                ingredient.Id = 0;
                await _context.AddAsync(_mapper.MapIngredient(ingredient));
            }
        }
Beispiel #35
0
        /// <summary>
        /// Description: This method maps list of ingredient type database object to list of ingredient model objects
        /// </summary>
        /// <param name="iIngredientTypeDBOList">List of ingredient type database objects</param>
        /// <returns>List of ingredient type Model objects </returns>
        public List <IngredientType> MapDBOToModel(List <IngredientTypeDBO> iIngredientTypeDBOList)
        {
            // list to store ingredient types
            List <IngredientType> lIngredientList = new List <IngredientType>();

            // map each database object to model object
            foreach (IngredientTypeDBO each in iIngredientTypeDBOList)
            {
                IngredientType lIngredientType = new IngredientType();

                // set values
                lIngredientType.IngredientTypeIDPK = each.IngredientTypeDBOIDPK;
                lIngredientType.IngredientTypeName = each.IngredientTypeDBOName;

                lIngredientList.Add(lIngredientType);
            }

            return(lIngredientList);
        }
    private void initAspect(IngredientType ingredient, GameObject lineItemInstance, String childName, Aspects.Secondary aspect)
    {
        GameObject iconButton = lineItemInstance.transform.Find(childName).gameObject;
        iconButton.GetComponent<Image>().sprite = Aspects.instance().getGreyedSprite(aspect);

        IngredientData.GuessState currentGuess = Ingredients.instance().getIngredient(ingredient).getGuessState(aspect);
        switch (currentGuess) {
            case IngredientData.GuessState.UNKNOWN:
                iconButton.GetComponent<Image>().sprite = Aspects.instance().getGreyedSprite(aspect);
                break;
            case IngredientData.GuessState.HAS:
                iconButton.GetComponent<Image>().sprite = Aspects.instance().getNormalSprite(aspect);
                break;
            case IngredientData.GuessState.NOT_HAS:
                iconButton.GetComponent<Image>().sprite = Aspects.instance().getDisabledSprite(aspect);
                break;
        }

        iconButton.GetComponent<Button>().onClick.AddListener(() => {
            IngredientData data = Ingredients.instance().getIngredient(ingredient);
            IngredientData.GuessState guess = data.getGuessState(aspect);

            IngredientData.GuessState next = IngredientData.GuessState.UNKNOWN;
            Image icon = iconButton.GetComponent<Image>();
            switch (guess) {
                case IngredientData.GuessState.UNKNOWN:
                    next = IngredientData.GuessState.HAS;
                    icon.sprite = Aspects.instance().getNormalSprite(aspect);
                    break;
                case IngredientData.GuessState.HAS:
                    next = IngredientData.GuessState.NOT_HAS;
                    icon.sprite = Aspects.instance().getDisabledSprite(aspect);
                    break;
                case IngredientData.GuessState.NOT_HAS:
                    next = IngredientData.GuessState.UNKNOWN;
                    icon.sprite = Aspects.instance().getGreyedSprite(aspect);
                    break;
            }

            data.setGuessState(aspect, next);
            updateWarningIcon(data, lineItemInstance);
        });
    }
        private void btnNewIngredient_Click(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(TbxIngredientName.Text))
            {
                if (!String.IsNullOrWhiteSpace(TbxIngredientPrice.Text))
                {
                    if (CbxIngredientType.SelectedItem != null)
                    {
                        IngredientType selectedIngredientType = (IngredientType)CbxIngredientType.SelectedItem;
                        Ingredient     newIngredient          = new Ingredient(Convert.ToDecimal(TbxIngredientPrice.Text), TbxIngredientName.Text, selectedIngredientType);

                        if (dbHandler.NewIngredient(newIngredient))
                        {
                            MessageBox.Show("Success! Ingrediensen blev tilføjet", "Success!");
                            DtgIngredients.ItemsSource = dbHandler.GetAllIngredients();

                            listOfAvailableIngredients = dbHandler.GetAllIngredients();
                            UpdateDataInNewRecipe();

                            TbxIngredientName.Clear();
                            TbxIngredientPrice.Clear();
                            CbxIngredientType.SelectedItem = null;
                        }
                        else
                        {
                            MessageBox.Show("Fejl! - Der skete en fejl. Ingrediensen blev ikke tilføjet", "Fejl!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Du skal vælge en type!", "Fejl!");
                    }
                }
                else
                {
                    MessageBox.Show("Du skal angive en pris!", "Fejl!");
                }
            }
            else
            {
                MessageBox.Show("Du skal angive et navn!", "Fejl!");
            }
        }
    public void notifyIngredientAdded(List <IngredientType> ingredients)
    {
        for (int i = 0; i < ingredients.Count && i < 3; i++)
        {
            Slot           slot = slots[i];
            IngredientType type = ingredients[i];

            slot.ingredient.sprite = IngredientRenderer.instance().getSprite(type);
            slot.ingredient.color  = Color.white;

            IngredientData ingredient = Ingredients.instance().getIngredient(type);
            slot.primary.sprite   = Aspects.instance().getNormalSprite(ingredient.getPrimaryGuess());
            slot.primary.color    = Color.white;
            slot.secondary.sprite = Aspects.instance().getNormalSprite(ingredient.getSecondaryGuess());
            slot.secondary.color  = Color.white;
        }

        nFilledSlots = ingredients.Count;
    }
Beispiel #39
0
    public Potion createPotion(IngredientType ingredient1, IngredientType ingredient2, IngredientType ingredient3)
    {
        IngredientData data1 = Ingredients.instance().getIngredient(ingredient1);
        IngredientData data2 = Ingredients.instance().getIngredient(ingredient2);
        IngredientData data3 = Ingredients.instance().getIngredient(ingredient3);

        MultiSet<Aspects.Secondary> secondaries = new MultiSet<Aspects.Secondary>();
        secondaries.Add(data1.secondary);
        secondaries.Add(data2.secondary);
        secondaries.Add(data3.secondary);

        Potion createdPotion = getBestMatch(data1.primary, data2.primary, data3.primary, secondaries);
        logPotionCreation(createdPotion, ingredient1, ingredient2, ingredient3);

        if (!hasDoneAutoPause && createdPotion != defaultPotion) {
            hasDoneAutoPause = true;
            GameObject.FindObjectOfType<PauseMenuController>().pause();
        }
        return createdPotion;
    }
 public IngredientData getIngredient(IngredientType type)
 {
     return ingredients[type];
 }
 public void addSeenIngredient(IngredientType type)
 {
     seenIngredients.Add(type);
 }
 // Use this for initialization
 void Start()
 {
     shelf = FindObjectOfType<ShelfInventory>();
     shelf.registerGenerator(this);
     currentIngredient = selectIngredient();
 }
 public IngredientData(IngredientType type, Aspects.Primary primary, Aspects.Secondary secondary)
 {
     this.type = type;
     this.primary = primary;
     this.secondary = secondary;
 }
 public Sprite getSprite(IngredientType type)
 {
     return sprites[type];
 }
Beispiel #45
0
 private void logPotionCreation(Potion potionMade, IngredientType ingredient1, IngredientType ingredient2, IngredientType ingredient3)
 {
     createdPotions.Add(new CreatedPotion(potionMade, ingredient1, ingredient2, ingredient3));
     Ingredients.instance().addSeenIngredient(ingredient1);
     Ingredients.instance().addSeenIngredient(ingredient2);
     Ingredients.instance().addSeenIngredient(ingredient3);
 }
Beispiel #46
0
		public Ingredient(IngredientType type, uint amount)
		{
			Type = type;
			Amount = amount;
		}
Beispiel #47
0
        public Ingredient(string n, IngredientType t)
        {
            Name = n;
            Percent = 1;
            Type = t;
            ingredients = new ObservableCollection<Ingredient>();

        }
Beispiel #48
0
 private bool isIngredientsAProduct(IngredientType pool, out GameObject product)
 {
     int c = combinations.Count;
     for (int i = 0; i < c; i++)
     {
         Combination combination = combinations[i];
         if (combination.bitmask == pool)
         {
             product = combination.product;
             return true;
         }
     }
     product = null;
     return false;
 }
		public void SetStoredAmount(IngredientType ingredientType, uint amount)
		{
			_ingredientTanks[(int)ingredientType].Amount = amount;
		}
Beispiel #50
0
			public IngredientTank(string stationName, IngredientType ingredientType)
			{
				IngredientType = ingredientType;
				FaultHelper.PrefixFaultNames(this, $"{stationName}.{ingredientType}");
			}
 public Ingredient(IngredientType type, int price)
     : base(type, Category.Ingredient, price)
 {
 }
Beispiel #52
0
 private void createPotion(IngredientType one, IngredientType two, IngredientType three)
 {
     Potion potion = Potions.instance().createPotion(one, two, three);
     // TODO: activate potion effect
 }
Beispiel #53
0
				public TankDepletedEffect(string stationName, IngredientType ingredientType)
					: base(stationName, ingredientType)
				{
				}
 private void add(IngredientType type, Aspects.Primary primary, Aspects.Secondary secondary)
 {
     ingredients.Add(type, new IngredientData(type, primary, secondary));
 }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     _type = IngredientType.NoSelect;
     this.Close();
 }
    private void initIngredientLineItem(IngredientType type)
    {
        GameObject display = Instantiate(lineItem);
        display.transform.SetParent(transform);

        setSprite(display, "Ingredient", IngredientRenderer.instance().getSprite(type));

        initAspect(type, display, "Dairy", Aspects.Primary.DAIRY);
        initAspect(type, display, "Veggie", Aspects.Primary.PLANT);
        initAspect(type, display, "Meat", Aspects.Primary.MEAT);
        initAspect(type, display, "Grain", Aspects.Primary.GRAIN);

        initAspect(type, display, "Fire", Aspects.Secondary.FIRE);
        initAspect(type, display, "Water", Aspects.Secondary.WATER);
        initAspect(type, display, "Void", Aspects.Secondary.VOID);
        initAspect(type, display, "Slime", Aspects.Secondary.SLIME);
        initAspect(type, display, "Decay", Aspects.Secondary.DECAY);
        initAspect(type, display, "Beast", Aspects.Secondary.BEAST);
        initAspect(type, display, "Seductive", Aspects.Secondary.SEDUCTIVE);

        display.transform.Find("Warning").GetComponent<Button>().onClick.AddListener(() => {
            showHelp();
        });
        updateWarningIcon(Ingredients.instance().getIngredient(type), display);
    }
Beispiel #57
0
 /// <summary>
 /// Ingredient that makes up a drink. ex: pineapple chunk, cherry, Orange slice,...
 /// </summary>
 /// <param name="Type">Soda, Water, Liquor</param>
 /// <param name="Name">Brand and type. e.g: Bacardi- Rum, Malibu- Coconut Rum</param>
 /// <param name="Serving">Amount per serving(Liquids are in ounces)</param>
 public Ingredient(IngredientType IngType, string BrandName, string Name, double Serving)
 {
     Type = IngType;
     Brand = BrandName;
     this.Name = Name;
     this.Serving = Serving;
 }
Beispiel #58
0
 public IngredientInfo(IngredientType a)
 {
     CrtModifyStatus = CommandCmdDef.ModifyType.NEWONE;
     Type = a;
     switch (a)
     {
         case IngredientType.ESPRESSO:
             _Espresso = new Ingredient_Espresso_extern();
             Name = "ESPRESSO";
             break;
         case IngredientType.FILTERBREW:
             _FilterBrew = new Ingredient_Filter_Brew_extern();
             Name = "FILTERBREW";
             break;
         case IngredientType.INSTANTPOWDER:
             _InstantPowder = new Ingredient_InstantPowder_extern();
             Name = "INSTANTPOWDER";
             break;
         case IngredientType.FRESHMILK:
             _FreshMilk = new Ingredient_Fresh_Milk_extern();
             Name = "FreshMilk";
             break;
         case IngredientType.Water:
             _Water = new Ingredient_Water();
             Name = "Water";
             break;
         default:
             break;
     }
 }
Beispiel #59
0
 private void createPotion(IngredientType one, IngredientType two, IngredientType three)
 {
     Potion potion = Potions.instance().createPotion(one, two, three);
     potion.TriggerEffect();
 }
Beispiel #60
0
 public Ingredient(string n, IngredientType t)
 {
     Name = n;
     Percent = 1;
     Type = t;
     ingredients = new ObservableCollection<Ingredient>();
     ToggleEntryModeCommand = new RelayCommand(toggleEntryMode);
 }