private TaskState Construct(Dwarf d, float dt)
 {
     d.GetActionWorldObject().CraftOnObject(d.GetActionWorldObject().CraftPointsNeeded);
     DwarfConsole.WriteLine("Placed Worldobject: " + d.GetActionWorldObject().ElementType +" " + d.GetActionWorldObject().Level, ConsoleColor.Blue);
     d.RemoveHoldingWorldObject();
     return TaskState.Success;
 }
Beispiel #2
0
        private TaskState Consume(Dwarf d, float dt)
        {
            if (d.GetHoldingWorldObject() == null)
                throw new Exception("Dwarf does not carry any tool");
            if (d.GetHoldingWorldObject().GetType().IsSubclassOf(typeof(Tool)) == false)
                throw new Exception("Dwarf tried to consume something that was not tool");

            Tool tool = (Tool)d.RemoveHoldingWorldObject();

            d.ConsumeTool(tool);

            return TaskState.PersonalSuccess;
        }
        private TaskState Deposit(Dwarf d, float dt)
        {
            //DwarfConsole.WriteLine("DepositeInBuilding: " + d.GetActionbuilding().BuildingType + " " + d.GetActionbuilding().Id + ", " + d.GetHoldingWorldObject().ElementType + " " + d.GetHoldingWorldObject().Level, ConsoleColor.Green);
            WorldObject m = d.RemoveHoldingWorldObject();

            if (m == null)
                throw new Exception("This should not happen");
                //return TaskState.Fail;

            d.GetActionbuilding().DepositWorldObject(m);

            return TaskState.Success;
        }
Beispiel #4
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;
        }