public Meal GetMeal(AbstractMeal mealBuilder, string drinkType = null) { mealBuilder.CreateMeal() .AddBurger() .AddColdDrink(drinkType); return(mealBuilder.GetMeal()); }
public void Eat(AbstractMeal meal) { Debug.Log ("Eat"); if(hungership >= 50){ GameObject.Find("Balloon").GetComponent<Balloon>().StartCoroutine("changeTextureMealFull"); }else{ GameObject.Find("Balloon").GetComponent<Balloon>().StartCoroutine("hideBalloon", 4); } transform.FindChild("Mouth").GetComponent<AbstractMouth>().Eat(); string mealName = meal.GetType().FullName; /* * ドロップされたのがリンゴなら if(mealName == "Apple" && move == null){ //リンゴ生成 move = new GameObject (); //spriteRenderer = GetComponent<SpriteRenderer>(); //名前付け move.name = "mApple"; //アニメーター付与 move.AddComponent<Animator> (); move.GetComponent<Animator> ().runtimeAnimatorController = RuntimeAnimatorController.Instantiate (Resources.Load<RuntimeAnimatorController> ("Animation/tool/eat_apple")); //スクリプト付与 move.AddComponent (typeof(MealMotion)); move.AddComponent<Animator>(); move.GetComponent<Animator>().runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load<RuntimeAnimatorController> ("Animation/tool/eat_apple")); } */ if(mealName == "Seed"){ hungership += (int)(meal.GetHungershipPoint() * 0.6 / level); }else{ hungership += meal.GetHungershipPoint(); } if(mealName == likeMeal){ friendship += (int)(meal.GetFriendshipPoint() * 1.5 / level); }else if(mealName == dislikeMeal){ friendship += (int)(meal.GetFriendshipPoint() * 0.5 / level); }else{ friendship += (int)(meal.GetFriendshipPoint() / level); } }
void Start() { hoge = false; if (this.gameObject.tag == "CareTool"){ abstractCareTool = this.gameObject.GetComponent<AbstractCareTool>(); } if (this.gameObject.tag == "Meal"){ abstractMeal = this.gameObject.GetComponent<AbstractMeal>(); } pet = GameObject.Find ("Pet"); _abstractPet = pet.GetComponent<AbstractPet>(); }