Esempio n. 1
0
    public void SetThisPlant(Item _PlayerFirstItem)
    {
        GrowthRateUntilSprout   = ThisPlant.GetGrowthRateUntilSprout();
        GrowthRateUntilMedium   = ThisPlant.GetGrowthRateUntilMedium();
        GrowthRateUntilFinished = ThisPlant.GetGrowthRateUntilMedium();

        GrowthModelSeed     = ThisPlant.GetGrowthModelSeed();
        GrowthModelSprout   = ThisPlant.GetGrowthModelSprout();
        GrowthModelMedium   = ThisPlant.GetGrowthModelMedium();
        GrowthModelFinished = ThisPlant.GetGrowthModelFinished();
        GrowthModelWithered = ThisPlant.GetGrowthModelWithered();

        ThisFinishedPlant = ThisPlant.GetFinishedPlant();

        GrowthModelSeedInstance     = Instantiate(GrowthModelSeed, transform);
        GrowthModelSproutInstance   = Instantiate(GrowthModelSprout, transform);
        GrowthModelMediumInstance   = Instantiate(GrowthModelMedium, transform);
        GrowthModelFinishedInstance = Instantiate(GrowthModelFinished, transform);
        GrowthModelWitheredInstance = Instantiate(GrowthModelWithered, transform);

        GrowthModelSeedInstance.SetActive(true);
        GrowthModelSproutInstance.SetActive(false);
        GrowthModelMediumInstance.SetActive(false);
        GrowthModelFinishedInstance.SetActive(false);
        GrowthModelWitheredInstance.SetActive(false);
    }
Esempio n. 2
0
    public void ResetField()                                //resets the field to an empty state
    {
        GrowthModelSeedInstance.SetActive(false);
        GrowthModelSproutInstance.SetActive(false);
        GrowthModelMediumInstance.SetActive(false);
        GrowthModelFinishedInstance.SetActive(false);
        GrowthModelWitheredInstance.SetActive(false);

        DaysUntilWithered = 3;
        IsSeeded          = false;
        ActiveFieldstate  = Fieldstate.empty;
    }
Esempio n. 3
0
    private void SwitchFields()         //this switches the different states of the Field (Enums)
    {
        switch (ActiveFieldstate)
        {
        case (Fieldstate.notThere):
            if (IsPlowed)
            {
                FieldDryInstance.SetActive(true);
                ActiveFieldstate = Fieldstate.empty;
            }
            break;

        case (Fieldstate.empty):                                            //if this field is empty
            if (IsSeeded)                                                   //if the player seeded the field
            {
                ActiveFieldstate = Fieldstate.seeded;                       //the field is now seeded
                DayOfProgress    = 0;
            }
            break;

        case (Fieldstate.seeded):                                           //if the plant is seeded
            GrowthModelSeedInstance.SetActive(true);

            if (DayOfProgress == GrowthRateUntilSprout)                     //and if the day is ended (only for the first step from seed --> sprout)
            {
                ActiveFieldstate = Fieldstate.sprout;                       //the seed growths into a sprout
                DayOfProgress    = 0;                                       //reset the progresstimer
            }
            break;

        case (Fieldstate.sprout):                                           //if the plant is a sprout
            GrowthModelSeedInstance.SetActive(false);
            GrowthModelSproutInstance.SetActive(true);

            if (DayOfProgress == GrowthRateUntilMedium)                     //and if the DayOfProgress matches the GrowthRateMedium step of the plant
            {
                ActiveFieldstate = Fieldstate.medium;                       //the plant reaches its 2nd stage of its growthcycle
                DayOfProgress    = 0;                                       //reset the progresstimer
            }
            break;

        case (Fieldstate.medium):                                           //if the plant is on its medium state
            GrowthModelSproutInstance.SetActive(false);
            GrowthModelMediumInstance.SetActive(true);

            if (DayOfProgress == GrowthRateUntilFinished)                   //and if the DayOfProgress matches the GrowthRateFinished step of the plant
            {
                ActiveFieldstate = Fieldstate.finished;                     //the plant is fully grown and ready to be harvested
                DayOfProgress    = 0;                                       //reset the progresstimer
            }
            break;

        case (Fieldstate.finished):                                         //if the plant is fully grown
            GrowthModelMediumInstance.SetActive(false);
            GrowthModelFinishedInstance.SetActive(true);

            if (DayOfProgress == 3)                                          //and if 3 days are passed
            {
                ActiveFieldstate = Fieldstate.withered;                      //the plant is withered
            }
            break;

        case (Fieldstate.withered):
            GrowthModelSeedInstance.SetActive(false);
            GrowthModelSproutInstance.SetActive(false);
            GrowthModelMediumInstance.SetActive(false);
            GrowthModelFinishedInstance.SetActive(false);
            GrowthModelWitheredInstance.SetActive(true);

            //MediumPlant.SetActive(false);
            break;
        }
    }