Exemplo n.º 1
0
    /*  Assess Plant
     *  Compares the water level in the planter to the root level of the plant
     *  Removes health if not enough water, too much water, or too many roots for the planter.
     */
    public void AssessPlant()
    {
        int rootWaterFactor = GetRootWaterFactor();

        // If the roots aren't in the water, remove HP
        if (rootWaterFactor == -1)
        {
            _Plant.RemoveHealth();
            HealthRemoved = true;
        }

        // If the roots are too wet, remove HP
        if (rootWaterFactor == 1)
        {
            _Plant.RemoveHealth();
            HealthRemoved = true;
        }

        // If the roots are too big for the container, remove HP
        if (_Plant.RootDepth > _Planter.GetSize() + 2)
        {
            _Plant.RemoveHealth();
            HealthRemoved = true;
            Debug.Log(string.Format("Removed HP because the container is too small - Container Size: {0}, Roots: {1}", _Planter.GetSize(), _Plant.RootDepth));
        }

        // If the plant hasn't lost HP. Add HP
        if (!HealthRemoved)
        {
            _Plant.AddHeath(_Planter.GetSize() + 2);
        }

        _Plant.PrintPlantStatus();
        _Planter.PrintPlanterStatus();
        _Planter.ReduceWater();
    }