예제 #1
0
 private void WitheredField()                            //if the plant is not watered for 3 days this function is called and "kills" the plant
 {
     if (DaysUntilWithered == 0)
     {
         ActiveFieldstate = Fieldstate.withered;
     }
 }
예제 #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;
    }
예제 #3
0
 public void SetIsPlowed(bool _NewState)
 {
     IsPlowed = _NewState;
     if (_NewState)
     {
         DaysUntilNotThere = 3;
         FieldDryInstance.SetActive(true);
     }
     else if (!_NewState)
     {
         ActiveFieldstate = Fieldstate.notThere;
         FieldDryInstance.SetActive(false);
         FieldWateredInstance.SetActive(false);
     }
 }
예제 #4
0
 void Update()
 {
     SwitchFields();
     WitheredField();
     if (IsWatered)
     {
         FieldDryInstance.SetActive(false);
         FieldWateredInstance.SetActive(true);
     }
     if (!IsPlowed)
     {
         ActiveFieldstate = Fieldstate.notThere;
         FieldDryInstance.SetActive(false);
         FieldWateredInstance.SetActive(false);
     }
 }
예제 #5
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;
        }
    }