示例#1
0
        public bool CheckIfGrowingIsPossible()
        {
            if (plantState == null)
            {
                plantState = new PlantState(plantType);
            }

            return(isReadyToGrow && plantState.SatisfyStats());
        }
示例#2
0
        public void UpdateFertilizationStats(string state)
        {
            if (plantState == null)
            {
                plantState = new PlantState(plantType);
            }

            plantState.UpdateFertilizationState(state);
            OnDataChange();
        }
示例#3
0
        public void Irrigate()
        {
            Debug.Log("He regado esta planta ");
            if (plantState == null)
            {
                plantState = new PlantState(plantType);
            }

            irrigationClock.ChangeState(-1);
            irrigationClock.Reset();
            plantState.UpdateIrrigationState(irrigationClock.GetCurrentState());
        }
示例#4
0
        public void Atemperate(float sunIntensity)
        {
            if (plantState == null)
            {
                plantState = new PlantState(plantType);
            }

            if (pot != null)
            {
                plantState.UpdatePlantTemperature(pot.GetTransformedTemperature(sunIntensity));
                OnDataChange();
            }
        }
示例#5
0
        public void Fertilizate(string fertilizationType)
        {
            if (plantState == null)
            {
                plantState = new PlantState(plantType);
            }

            if (fertilizationType == plantState.GetDesiredValues().fertilizationType)
            {
                fertilizationClock.ChangeState(-1);
                fertilizationClock.Reset();
                plantState.UpdateFertilizationState(fertilizationClock.GetCurrentState());
            }
        }
示例#6
0
        public void Awake()
        {
            if (plantState == null)
            {
                plantState = new PlantState(plantType);
            }

            plantState.Grow("seeds");

            //Initialize clocks
            irrigationClock.SetTicks(plantState.GetDesiredValues().irrigationRate / irrigationClock.GetStates().Length);
            fertilizationClock.SetTicks(plantState.GetDesiredValues().fertilizationRate / fertilizationClock.GetStates().Length);
            growingClock.SetTicks(plantState.GetDesiredValues().growingRate / growingClock.GetStates().Length);

            irrigationClock.SetName("IrrigationClock" + GetInstanceID());
            fertilizationClock.SetName("FertilizationClock" + GetInstanceID());
            growingClock.SetName("GrowingClock" + growingClock.gameObject.GetInstanceID());
        }