Exemplo n.º 1
0
    private void CheckStage()
    {
        var start   = DateTime.Now;
        var oldDate = DateTime.Parse(plantStats[9]);

        if (plantStats[3] == "1") //baby
        {
            timeToChangeTheStage = baby_time;
            //print(timeToChangeTheStage);
        }
        if (plantStats[3] == "2") //teen
        {
            timeToChangeTheStage = teen_time;
        }
        if (plantStats[3] == "3") //adult
        {
            timeToChangeTheStage = adult_time;
        }
        if (plantStats[3] == "4") //elderly
        {
            timeToChangeTheStage = elderly_time;
        }
        if ((start - oldDate).TotalMinutes >= timeToChangeTheStage)
        {
            plantStats[3] = (Int16.Parse(plantStats[3]) + 1).ToString();
            plantStats[9] = DateTime.Now.ToString();
            //change texture-- get ze plant out-- change database;


            db.ChangeStageDate(transform.name, plantStats[9]);
            if (short.Parse(plantStats[3]) <= 2)
            {
                db.ChangeStage(transform.name, plantStats[3]);
                EvolveThePlant();
            }
            else if (short.Parse(plantStats[3]) > 2)
            {
                db.ChangeStage(transform.name, plantStats[3]);
                db.ChangePlace(transform.name, "100");
                GetPlantOutOfIncubator();
            }
        }
    }