public IEnumerator SpawnElements(BurgerData data) { var ings = data._ingridients; var spawns = ings.Where(ingridient => ingridient.GetObject() != null).Select(ingridient => ingridient.GetObject()).ToList(); spawns.ForEach(ingridient => { var obj = Instantiate(ingridient); obj.SetActive(false); obj.layer = 9; _schedule.Add(obj.GetComponent <ISpawnable>()); }); for (int i = 0; i < _spawnZones.Count; i++) { if (_schedule.Count == 0) { break; } _spawnZones[i].Spawn(_schedule[0]); _schedule.RemoveAt(0); yield return(new WaitForSeconds(0.2f)); } if (_schedule.Count != 0) { GameLogic.Instance.PlayerBurger.IngridientAction += PlaceScheduledIngridient; } }
private void Start() { burgerId = ManagementId.GetburgerId; //マネージャーからID受け取り //burgerId = "burger0"; // かり BurgerData burgerdata = BurgerData.GetData(burgerId); }
/// <summary> /// IDからハンバーガーデータをロード. /// </summary> public static BurgerData GetData(string id) { BurgerData ret = Resources.Load <BurgerData>("BurgerData/" + id); if (ret == null) { Debug.LogError("データのロードに失敗 id:" + id); } return(ret); }
private void Start() { burgerId = ManagementId.GetburgerId; //マネージャーからID受け取り BurgerData data = BurgerData.GetData(burgerId); partsNum = data.foodPartsId.Count; delayTime = Constant.GameMain.NextDelayTime; }
public void ClearRequest(ref BurgerData data) { foreach (var ingridient in data._ingridients) { var ing = ingridient as IEditable; Destroy(ing.GetTransform().gameObject); } data._ingridients.Clear(); }
void Start() { burgerId = ManagementId.GetburgerId; //マネージャーからID受け取り //burgerId = "burger0"; burgerData = BurgerData.GetData(burgerId); foodId = burgerData.foodPartsId; SetCharacter(); }
IEnumerator CreateWindow() { yield return(new WaitForSeconds(1.0f)); goalPanel.SetActive(true); BurgerData data = BurgerData.GetData(ManagementId.GetburgerId); goalBurgerImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.BurgerImage + data.id); goalBurgerText.text = data.burgerName; //Debug.Log(ManagementId.GetburgerId); }
IEnumerator CreateCharacter() { BurgerData data = BurgerData.GetData(burgerId); List <int> foods = data.foodPartsId; for (int i = 1; i < foods.Count; i++) { var obj = Instantiate(Resources.Load <GameObject>(Constant.Path.Resources.GameMainPrefabs + "WaitCharacterFrame")); obj.GetComponent <GenerateCharacterImage>().SetFoodPartsId(Constant.ScriptableName.FoodPartsData + foods[i]); obj.transform.SetParent(waitCharacterContent.transform); obj.transform.localPosition = Vector3.one; //背面にいかないように obj.transform.localScale = Vector3.one; } yield return(0); }
private void Start() { burgerId = ManagementId.GetburgerId; //マネージャーからID受け取り BurgerData data = BurgerData.GetData(burgerId); if (PlayerPrefs.GetInt("isGetBurger" + data.id) == 0) { newIcon.SetActive(true); } PlayerPrefs.SetInt("isGetBurger" + data.id, 1); var totalCoin = PlayerPrefs.GetInt(Key.Common.TotalCoin); PlayerPrefs.SetInt(Key.Common.TotalCoin, totalCoin + data.getCoinNum); }
public Customer.CustomerRequest CreateRequest(ref BurgerData data, int scheduleNumber) { var burger = FillBurger(_difficultyPattern[_offset]); foreach (var ing in burger) { var spawnedIng = SpawnIngridient(ing); data.AddIngridient(spawnedIng); } Customer.CustomerRequest request = new Customer.CustomerRequest() { Burger = data, Price = CalcPrice(scheduleNumber) }; return(request); }
public static float Compare(BurgerData original, BurgerData comparable) { float status = 0; var ratables = comparable._ingridients.Select(ingridient => ingridient as IRatable).Where(ratable => ratable != null).ToArray(); if (comparable._ingridients.Count == original._ingridients.Count) { for (int i = 1; i < original._ingridients.Count; i++) { var comparableRatable = comparable._ingridients[i] as IRatable; if (original._ingridients[i].GetType() == comparable._ingridients[i].GetType()) { if (comparableRatable != null) { status += (comparableRatable.GetRating() / ratables.Length); } } } } else if (comparable._ingridients.Count < original._ingridients.Count) { for (int i = 1; i < comparable._ingridients.Count; i++) { var comparableRatable = comparable._ingridients[i] as IRatable; if (original._ingridients[i].GetType() == comparable._ingridients[i].GetType()) { if (comparableRatable != null) { status += (comparableRatable.GetRating() / ratables.Length); } } } } else if (comparable._ingridients.Count > original._ingridients.Count) { } return(status); }
void CreateMenu(string id) { BurgerData data = BurgerData.GetData(id); var num = data.id; resultBurgerImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.BurgerImage + num); var level = data.difficulty; resultLevelImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.LevelImage + level); menuBurgerImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.BurgerImage + num); menuNameImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.ResuleBurgerName + num); var getCoin = data.getCoinNum; menuGetCoin.text = getCoin.ToString(); menuTotalCoin.text = PlayerPrefs.GetInt(Key.Common.TotalCoin).ToString(); }
void CreateMenuWindow(string id) { BurgerData data = BurgerData.GetData(id); var num = data.id; if (PlayerPrefs.GetInt("isGetBurger" + num) != 0) { burgerImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.BurgerImage + num); levelImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.LevelImage + data.difficulty); nameImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.BookBurgerName + num); bookImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.BookImage + num); memoImage.sprite = Resources.Load <Sprite>(Constant.Path.Resources.ExplanationImage + num); coinText.text = data.getCoinNum.ToString(); menuWindow.SetActive(true); } }