//게임 다시 시작할 때 셋팅용으로 쓰는 함수 IEnumerator Wait_generating_start(farm farm) { if (farm.is_money_on) { farm.money.gameObject.SetActive(true); } else if (farm.isFarming) { farm.item1.gameObject.SetActive(true); farm.item2.gameObject.SetActive(false); farm.item3.gameObject.SetActive(false); while (farm.remaining_time > 0) { if (farm.remaining_time < (farm.item.farm_time / 3) * 2) { farm.item2.gameObject.SetActive(true); } if (farm.remaining_time < farm.item.farm_time / 3) { farm.item3.gameObject.SetActive(true); } yield return(new WaitForSeconds(1)); Debug.Log(farm.remaining_time); farm.remaining_time--; } farm.money.gameObject.SetActive(true); } }
public GameScreen() { InitializeComponent(); g = new grandma(40, 1.3F, 1); int c = g.upgrade_cost; g = new grandma(c, 1.3F, 1); r = new robot(150, 1.3F, 6); int a = r.upgrade_cost; r = new robot(a, 1.3F, 6); f = new farm(2000, 1.3F, 15); int b = f.upgrade_cost; f = new farm(b, 1.3F, 15); fa = new factory(9000, 1.3F, 50); int d = fa.upgrade_cost; fa = new factory(d, 1.3F, 50); clon = new cloner(90000, 1.3F, 110); int e = clon.upgrade_cost; clon = new cloner(e, 1.3F, 119); atom = new atomic(200000, 1.3F, 1100); int h = atom.upgrade_cost; atom = new atomic(h, 1.3F, 1100); ali = new alien(600000, 1.3F, 11000); int l = ali.upgrade_cost; ali = new alien(l, 1.3F, 11000); kyr = new krypto(9000000, 1.3F, 601000); int i = kyr.upgrade_cost; kyr = new krypto(i, 1.3F, 601000); hac = new HACK(150000000, 1.3F, 4000000); int j = hac.upgrade_cost; hac = new HACK(j, 1.3F, 4000000); win = new WIN(2000000000); int k = win.upgrade_cost; win = new WIN(k); }
//생성까지 시간 차감하며 기다리기 IEnumerator Wait_generating(farm farm) { farm.isFarming = true; farm.farm_opportunity--; farm.remaining_time = farm.item.farm_time; farm.item1.gameObject.SetActive(true); farm.item2.gameObject.SetActive(false); farm.item3.gameObject.SetActive(false); if (farm.item.name == "turtle") { farm.item1.rectTransform.localScale = new Vector3((float)1.2, (float)0.8, (float)0.8); farm.item2.rectTransform.localScale = new Vector3((float)1.2, 1, 1); farm.item3.rectTransform.localScale = new Vector3((float)1.2, 1, 1); } else { farm.item1.rectTransform.localScale = new Vector3(1, 1, 1); farm.item2.rectTransform.localScale = new Vector3(1, 1, 1); farm.item3.rectTransform.localScale = new Vector3(1, 1, 1); } StartCoroutine(item_effect(farm.item1)); bool item2_effect_On = false; bool item3_effect_On = false; while (farm.remaining_time > 0) { if ((farm.remaining_time < (farm.item.farm_time / 3) * 2) && (farm.remaining_time >= farm.item.farm_time / 3)) { farm.item2.gameObject.SetActive(true); if (!item2_effect_On) { StartCoroutine(item_effect(farm.item2)); //움찔움찔 이펙트 item2_effect_On = true; } } if (farm.remaining_time < farm.item.farm_time / 3) { farm.item3.gameObject.SetActive(true); if (!item3_effect_On) { StartCoroutine(item_effect(farm.item3)); //움찔움찔 이펙트 item3_effect_On = true; } } yield return(new WaitForSeconds(1)); farm.remaining_time--; } farm.isFarming = false; farm.money.gameObject.SetActive(true); }
/// <summary> /// Renders detail view of the farm /// </summary> /// <param name="id">Id of the requested detail of the farm</param> /// <returns>View along with farm model</returns> public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } farm farm = db.farms.Find(id); if (farm == null) { return(HttpNotFound()); } return(View(farm)); }
/// <summary> /// Renders view for editing farm /// </summary> /// <param name="id">Id of the requested edit of the farm</param> /// <returns>View along with farm model</returns> public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } farm farm = db.farms.Find(id); if (farm == null) { return(HttpNotFound()); } ViewBag.provinceCode = new SelectList(db.provinces.OrderBy(a => a.name), "provinceCode", "name", farm.provinceCode); return(View(farm)); }
public IEnumerator itemAnim(farm farm, Image img) { while (farm.item_generating != null) { img.sprite = Resources.Load <Sprite>("items_anim/" + this.item.name + "1"); yield return(new WaitForSeconds(0.5f)); img.sprite = Resources.Load <Sprite>("items_anim/" + this.item.name + "2"); yield return(new WaitForSeconds(0.5f)); img.sprite = Resources.Load <Sprite>("items_anim/" + this.item.name + "1"); yield return(new WaitForSeconds(0.5f)); img.sprite = Resources.Load <Sprite>("items_anim/" + this.item.name + "2"); yield return(new WaitForSeconds(4f)); } }
public ActionResult DeleteConfirmed(int id) { try { farm farm = db.farms.Find(id); db.farms.Remove(farm); db.SaveChanges(); TempData["message"] = "Farm deleted successfully"; TempData["messageType"] = "success"; } catch (Exception ex) { TempData["message"] = "Error deleting farm: " + ex.GetBaseException().Message; TempData["messageType"] = "danger"; } return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "farmId,name,address,town,county,provinceCode,postalCode,homePhone,cellPhone,directions,dateJoined,lastContactDate")] farm farm) { try { if (ModelState.IsValid) { db.farms.Add(farm); db.SaveChanges(); TempData["message"] = "Farm created successfully"; TempData["messageType"] = "success"; return(RedirectToAction("Index")); } } catch (Exception ex) { TempData["message"] = "Error creating farm: " + ex.GetBaseException().Message; TempData["messageType"] = "danger"; } return(View(farm)); }
public ActionResult Edit([Bind(Include = "farmId,name,address,town,county,provinceCode,postalCode,homePhone,cellPhone,directions,dateJoined,lastContactDate")] farm farm) { try { if (ModelState.IsValid) { db.Entry(farm).State = EntityState.Modified; db.SaveChanges(); TempData["message"] = "Farm " + farm.name + " update successfully"; TempData["messageType"] = "success"; return(RedirectToAction("Index")); } } catch (Exception ex) { TempData["message"] = "Error updating farm: " + ex.GetBaseException().Message; TempData["messageType"] = "danger"; } ViewBag.provinceCode = new SelectList(db.provinces.OrderBy(a => a.name), "provinceCode", "name", farm.provinceCode); return(View(farm)); }
chickenHouseSelect(farm, animal);
duckHouseSelect(farm, animal);
GrazingFieldSelect(farm, animal);