Ejemplo n.º 1
0
    IEnumerator Wait(DatTrong dat, float seconds)
    {
        dat.DangCao = true;
        yield return(new WaitForSeconds(seconds));

        dat.CaoDat();
    }
Ejemplo n.º 2
0
 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;
        }
    }
Ejemplo n.º 4
0
    void CaoDat()
    {
        DatTrong dat = dat_current;

        Instantiate(CuocDat, dat.transform).transform.position = dat.getDiaChi();
        StartCoroutine(Wait(dat, 1.5f));
        SaveGame();
    }
Ejemplo n.º 5
0
    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"));
        }
    }
Ejemplo n.º 6
0
 void setDat_Current()
 {
     dat_current = getDatTrongSelecting();
 }