IEnumerator Wait(DatTrong dat, float seconds) { dat.DangCao = true; yield return(new WaitForSeconds(seconds)); dat.CaoDat(); }
public DatTrongSave(DatTrong dat) { DiaChi = dat.getDiaChi(); Tree.CODE = dat.GetCODE(); ThoiGianBatDauTrong = new ThoiGian(dat.getThoiGianTrong()); TrangThai = dat.getTrangThai(); }
public void HienThi(DatTrong dat) { // Hinh Anh if (dat.transform.childCount != 0) { Pic.sprite = dat.Tree.Pic; } // Ten Name.text = dat.Tree.Name; // So Luong SoLuong.text = Languages.getString("SoLuong") + ": " + dat.Tree.SoLuong.ToString(); // Timeleft va slider long timedatrong = (long)(DateTime.Now - dat.getThoiGianTrong()).TotalMilliseconds; long tongthoigian = (long)dat.Tree.ThoiGianLon * 60 * 1000; long miniGiay = tongthoigian - timedatrong; long Giay = miniGiay / 1000; if (miniGiay > 0) { TimeLeft.text = GameController.getStringTime(Giay); sliderTime.value = (float)timedatrong / tongthoigian; } else { TimeLeft.text = Languages.getString("CoTheThuHoach"); sliderTime.value = 1; } }
void CaoDat() { DatTrong dat = dat_current; Instantiate(CuocDat, dat.transform).transform.position = dat.getDiaChi(); StartCoroutine(Wait(dat, 1.5f)); SaveGame(); }
void TrongCay() { CayTrong cay = VC.getCayTrongDaChon(); if (cay == null) { return; } int gia = cay.getGiaMua(); if (Personal.DOLA >= gia) { DatTrong dat = getDatTrongSelecting(); dat.TrongCay(cay); Personal.AddDOLA(-cay.getGiaMua()); SaveGame(); } else { Notification.ReMind(Languages.getString("MuaThatBai")); } }
void setDat_Current() { dat_current = getDatTrongSelecting(); }