Exemplo n.º 1
0
    // Eat.
    public Report Eat(Shelter s)
    {
        Report r           = new Report();
        int    consumption = Random.Range(_appetite, _appetite + 4);

        if (s.EatFood(consumption) == false)
        {
            r = AdvanceHunger();

            if (_starvation == hunger.Starving)
            {
                Health--;
            }
            if (Health < 0)
            {
                r.SetMessage(_name + " has starved to death.");
                s.KillSurvivor(this.Name);
            }
            if (_starvation == hunger.Famished || _starvation == hunger.Starving)
            {
                return(r);
            }
            else
            {
                return(null);
            }
        }
        else
        {
            _starvation = hunger.Content;
        }
        return(null);
    }
Exemplo n.º 2
0
    // Advances the hunger. Moves the survivor to the next level of starvation
    public Report AdvanceHunger()
    {
        Report r = new Report();

        if (_starvation != hunger.Starving)
        {
            _starvation = (hunger)((int)_starvation + 1);
            r.SetMessage(_name + " is now " + _starvation.ToString() + ".");
        }
        else          //_starvation == hunger.Starving
        {
            r.SetMessage(_name + " is starving to death.");
        }

        return(r);
    }