public void DoEat(FoodType food) { if (food != FoodType.Meat) { Console.WriteLine("狗吃" + food.ToString()); } }
public void WeaponChange(FoodType newWeapon, bool isRanged, int ammo) { if (isRanged) { setAmmo(ammo); } setName(newWeapon.ToString(), isRanged); setImage((int)newWeapon, isRanged); }
void OnTriggerEnter(Collider c) { Debug.Log("Eating Now!"); if (c.CompareTag(foodType.ToString())) { GetComponent <Animator>().SetTrigger("Eat"); StartCoroutine(HideFood(c.gameObject)); } }
public void RandomSprite() { int type = (int)ftype; while (type == (int)ftype) { type = UnityEngine.Random.Range(1, 8); } ftype = (FoodType)type; img.sprite = UIAtlasManager.Instance.LoadSprite(UIAtlasName.UIMain, ftype.ToString()); }
public Food ProduceFood(FoodType foodType) { string objID = $"{foodType.ToString()}_{s_uniqueID++}"; var resource = Resources.Load($"Prefabs/Food/{foodType.ToString()}"); if (resource == null) { Debug.Log($"{foodType.ToString()}가 없어.."); return(null); } var newObj = Instantiate(resource) as GameObject; var newFood = newObj.GetComponent <Food>(); newFood.ObjectID = objID; foodsList.Add(objID, newFood); return(newFood); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (ValidateQuantity(selectedFood) > 0) { lstSale.Items.Add(txtQuantity.Text + " " + selectedFood.ToString() + ":" + txtPrice.Text + " " + double.Parse(txtQuantity.Text) * double.Parse(txtPrice.Text)); Total = Total + double.Parse(txtQuantity.Text) * double.Parse(txtPrice.Text); txtTotal.Text = Total.ToString(); } else { MessageBox.Show("Preparatul nu este disponibil in stoc!"); } }
public List <MenuItem> GetMenu() { var MenuContext = restContext.Food.ToList(); List <MenuItem> Menu = new List <MenuItem>(); FoodType temp = new FoodType(); for (int i = 0; i < Enum.GetNames(typeof(FoodType)).Length; i++) //needs error check { for (int j = 0; j < MenuContext.Count; j++) { temp = (FoodType)i; if (MenuContext[j].Foodtype == temp.ToString()) { Menu.Add(Mapper.Map(MenuContext[j])); } } } return(Menu); }
/// <summary> /// return food /// ! can be null /// </summary> /// <param name="type"></param> /// <returns></returns> public static Food CreateFood(FoodType type) { Food food = null; switch (type) { case FoodType.TomatoScrambledEggs: food = new TomatoScrambledEggs(); break; case FoodType.ShreddedPorkWithPotatoe: food = new ShreddedPorkWithPotatoe(); break; default: Log.Error("FoodFactory not contain this case", type.ToString()); break; } return(food); }
void Generate(FoodType foodType) { GameObject food = (GameObject)Instantiate(Resources.Load("InGame/foodObject/FoodObjectKan" + foodType.ToString())); food.transform.position = this.generatePosiotion; food.transform.parent = this.transform; Vector3 direction = (this.exitPosiotion - this.generatePosiotion).normalized; food.GetComponent <FoodObject>().Init(direction, this.laneModel.speed * this.currentQuest.GetDifficulySpeed(), this.exitPosiotion.x); }
public override string ToString() { return(Type.ToString() + " " + days + " days old"); }
public void DoEat(FoodType food) { Console.WriteLine("人吃" + food.ToString()); }
public Sprite GetFoodIcon(FoodType type) { return(Array.Find(FoodIcon, p => p.name == type.ToString())); }
public override string ToString() { return(FoodType.ToString() + " " + AnimalSize.ToString() + " " + points.ToString()); }