public void PlanterLegume() { LegumsMenuController legumeselected = shop.GetComponent <ShopController>().GetLegumeSelected().GetComponent <LegumsMenuController>(); DateTime tempsDep = DateTime.ParseExact(legumeselected.Desc.DebutPeriodePlantage, "yyyy-MM-dd", CultureInfo.InvariantCulture); DateTime tempsFin = DateTime.ParseExact(legumeselected.Desc.FinPeriodePlantage, "yyyy-MM-dd", CultureInfo.InvariantCulture); //Debug.Log(tempsDep); //Debug.Log(ui.GetComponent<UIManager>().CompareDateJeu(ui.GetComponent<UIManager>().GetDateJeuDT(), tempsDep)); if (ui.GetComponent <UIManager>().CompareDateJeu(ui.GetComponent <UIManager>().GetDateJeuDT(), tempsDep) == 0 || ui.GetComponent <UIManager>().CompareDateJeu(ui.GetComponent <UIManager>().GetDateJeuDT(), tempsFin) == 2) { GameObject newFermier = Instantiate(fermier); newFermier.transform.SetParent(ui.gameObject.transform); newFermier.GetComponent <FermierController>().SetPhrasePasPlanter(); } else { ShowOrHideParsellesPotagerPlantable(); } }
public void PlanterLegume() { LegumsMenuController legumeselected = shop.GetComponent <ShopController>().GetLegumeSelected().GetComponent <LegumsMenuController>(); DateTime tempsDep = DateTime.ParseExact(legumeselected.Desc.DebutPeriodePlantage, "yyyy-MM-dd", CultureInfo.InvariantCulture); DateTime tempsFin = DateTime.ParseExact(legumeselected.Desc.FinPeriodePlantage, "yyyy-MM-dd", CultureInfo.InvariantCulture); if (ui.GetComponent <UIManager>().CompareDateJeu(ui.GetComponent <UIManager>().GetDateJeuDT(), tempsDep) == 0 || ui.GetComponent <UIManager>().CompareDateJeu(ui.GetComponent <UIManager>().GetDateJeuDT(), tempsFin) == 2) { if (ui.GetComponent <UIManager>().Aide) { GameObject newFermier = Instantiate(fermier); newFermier.transform.SetParent(ui.gameObject.transform); newFermier.GetComponent <FermierController>().SetPhrasePasPlanter(); } else { GameObject newXP = Instantiate(plusXp, new Vector3(0, 0, 0), new Quaternion(0f, 0f, 0f, 0f)); databaseUpdate.UpdateProfilExp(jeu.Profil.Experience - 100); jeu.Profil.DateSortie = ui.GetComponent <UIManager>().GetDateJeu(); databaseUpdate.UpdateProfilDate(jeu.Profil.DateSortie); newXP.GetComponent <PlusExpController>().SetMoinsXp(100); } } else { if (shop.GetComponent <ShopController>().Parcelle != null) { GameObject parcelle = shop.GetComponent <ShopController>().Parcelle; parcelle.GetComponent <ParselleController>().PlanterLegumeParcelle(this.gameObject); } else { ShowOrHideParsellesPotagerPlantable(); } } }
// Update is called once per frame void Update() { LegumsMenuController legume = legumeSelected.GetComponent <LegumsMenuController>(); descContainer.transform.GetChild(0).GetChild(1).GetComponent <TextMeshProUGUI>().text = legume.Desc.TexteDescription; descContainer.transform.GetChild(1).GetChild(0).GetComponent <TextMeshProUGUI>().text = legume.Nom; DateTime tempsDep = DateTime.ParseExact(legume.Desc.DebutPeriodePlantage, "yyyy-MM-dd", CultureInfo.InvariantCulture); DateTime tempsFin = DateTime.ParseExact(legume.Desc.FinPeriodePlantage, "yyyy-MM-dd", CultureInfo.InvariantCulture); switch (game.Profil.IdNiveau) { case 1: periodePlantage.text = "Entre " + tempsDep.ToString("dd/MM", CultureInfo.InvariantCulture) + " et " + tempsFin.ToString("dd/MM", CultureInfo.InvariantCulture); tempsPousse.text = "Entre " + legume.Desc.TempsPousseMin + " et " + legume.Desc.TempsPousseMax + " jours"; break; case 2: if (ui.GetSaison(tempsDep) == "printemps") { periodePlantage.text = "Au " + ui.GetSaison(tempsDep); } else { periodePlantage.text = "En " + ui.GetSaison(tempsDep); } int moyenne = (int)(legume.Desc.TempsPousseMin + legume.Desc.TempsPousseMax) / 2; tempsPousse.text = "Environ " + moyenne.ToString() + " jours"; break; case 3: periodePlantage.text = "Indisponible"; tempsPousse.text = "Indisponible"; break; } }