Ejemplo n.º 1
0
    public void OnStateChanged(int newSun, int newWater)
    {
        Need thisChange = Need.Nothing;

        if (newSun != curSun)
        {
            thisChange = Need.Sun;
        }
        if (newWater != curWater)
        {
            thisChange = Need.Water;
        }
        if (thisChange.Equals(currentNeed))
        {
            Grow();
        }
        else if (thisChange.Equals(Need.Nothing))
        {
            // do nothing
        }
        else
        {
            Die();
        }
    }