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);
    }
示例#3
0
    void OnTriggerEnter(Collider c)
    {
        Debug.Log("Eating Now!");

        if (c.CompareTag(foodType.ToString()))
        {
            GetComponent <Animator>().SetTrigger("Eat");
            StartCoroutine(HideFood(c.gameObject));
        }
    }
示例#4
0
    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());
    }
示例#5
0
文件: World.cs 项目: jei-W/duckFarm
    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);
    }
示例#6
0
 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!");
     }
 }
示例#7
0
        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);
        }
示例#8
0
        /// <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);
    }
示例#10
0
文件: Food.cs 项目: FiammaV/MyAula10
 public override string ToString()
 {
     return(Type.ToString() + " " + days + " days old");
 }
 public void DoEat(FoodType food)
 {
     Console.WriteLine("人吃" + food.ToString());
 }
示例#12
0
 public Sprite GetFoodIcon(FoodType type)
 {
     return(Array.Find(FoodIcon, p => p.name == type.ToString()));
 }
示例#13
0
 public override string ToString()
 {
     return(FoodType.ToString() + "   " + AnimalSize.ToString() + "   " + points.ToString());
 }