Example #1
0
    public static Herb Factory(int cellID, Herbs type)
    {
        Herb herb = Herb.Factory(type);

        herb.Cell = Cell.FromId(cellID);
        return(herb);
    }
Example #2
0
    public static Herb Factory(Herbs type)
    {
        herbType = type;
        GameObject herbGo = PhotonNetwork.Instantiate("Prefabs/Tokens/" + herbType, Vector3.zero, Quaternion.identity, 0);

        token = herbGo;
        Herb herb = herbGo.GetComponent <Herb>();

        herb.Cell = null;
        if (type == Herbs.Herb3)
        {
            herb.maxUse = 3;
        }
        else
        {
            herb.maxUse = 4;
        }
        return(herb);
    }
Example #3
0
        public async Task <IActionResult> Create([Bind("Name, Calories, Origin")] Seasoning seasoning, [Bind("Hotness")] Herbs herbs)
        {
            if (ModelState.IsValid)
            {
                _context.Seasoning.Add(seasoning);
                herbs.Id = seasoning.Id;
                _context.Add(herbs);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Seasoning, "Id", "Id", herbs.Id);
            return(View(herbs));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Name, Calories, Origin")] Seasoning seasoning, [Bind("Id,Hotness")] Herbs herbs)
        {
            if (id != herbs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    seasoning.Id = id;
                    _context.Seasoning.Update(seasoning);
                    _context.Update(herbs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HerbsExists(herbs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Seasoning, "Id", "Id", herbs.Id);
            return(View(herbs));
        }
Example #5
0
        private void btn_Herbs_Click(object sender, RoutedEventArgs e)
        {
            Herbs herbs = new Herbs();

            herbs.Show();
        }
Example #6
0
 public void OnEnable()
 {
     myType = herbType;
 }