Exemple #1
0
        private TaskState Eat(Dwarf d, float dt)
        {
            if (d.GetHoldingWorldObject() == null)
                throw new Exception("Dwarf does not carry any food");
            if (d.GetHoldingWorldObject().GetType().IsSubclassOf(typeof(Food)) == false)
                throw new Exception("Dwarf tried to eat something that was not food");

            Food food = (Food)d.RemoveHoldingWorldObject();

            d.EatFood(food);

            if (d.Stats.Hunger < 100)
                return TaskState.PersonalFailTryTaskAgain;
            else
                return TaskState.PersonalSuccess;
        }