コード例 #1
0
 private TaskState Construct(Dwarf d, float dt, double dtd)
 {
     // TODO: WorldObject is currently constructed instantly because of this code line. This should change in the future
     d.GetActionWorldObject().CraftOnObject(d.GetActionWorldObject().CraftPointsNeeded);
     DwarfConsole.WriteLine("Placed Worldobject: " + d.GetActionWorldObject().ElementType +" " + d.GetActionWorldObject().Level, ConsoleColor.Blue);
     d.RemoveHoldingWorldObject();
     return TaskState.Success;
 }
コード例 #2
0
        private TaskState Pickup(Dwarf d, float dt, double dtd)
        {
            WorldObject me = d.GetActionWorldObject();

            //if ((int)d.Position.X != me.Position.X || (int)d.Position.Y != me.Position.Y)
            //    throw new Exception("Dwarf not in place");
            Console.WriteLine("Pickup: " + d.Id + " - " + d.GetActionWorldObject().Position.X + ", " + d.GetActionWorldObject().Position.Y);
            d.GetActionMapElement().RemoveFromMap();
            d.CarryWorldObject(d.GetActionWorldObject());
            return TaskState.Success;
        }
コード例 #3
0
        private TaskState FindPath(Dwarf d, float dt, double dtd)
        {
            WorldObject m = d.GetActionWorldObject();

            if (State == TaskState.NotActive)
            {
                AsyncPathfinding.RequestPathfinding(d, new Point((int)d.Position.X, (int)d.Position.Y), new Point(m.Position.X, m.Position.Y), null);
            }

            List<Path> paths = AsyncPathfinding.GetFinishedPaths(d);
            if (paths.Count == 0)
                return TaskState.Running;
            else
            {
                if (paths[0] == null)
                    return TaskState.Fail;

                d.SetMovePath(paths[0]);

                Point p = paths[0].PathPoints[paths[0].PathPoints.Count - 1];

                if (p.X == m.Position.X && p.Y == m.Position.Y)
                {

                }
                else
                {

                }

                return TaskState.Success;
            }
        }
コード例 #4
0
        private TaskState Pickup(Dwarf d, float dt, double dtd)
        {
            WorldObject obj = d.GetActionPasture().WithdrawWorldObject(d.GetActionWorldObject());
            d.CarryWorldObject(obj);

            return TaskState.Success;
        }
コード例 #5
0
 private TaskState Check(Dwarf d, float dt, double dtd)
 {
     if (d.GetActionbuilding().GetCraftSlot() == null)
         return TaskState.Absolete;
     if (d.GetActionbuilding().GetCraftSlot().Id.ToString() != d.GetActionWorldObject().Id.ToString())
         return TaskState.Absolete;
     return TaskState.Success;
 }
コード例 #6
0
ファイル: HarvestOnCrop.cs プロジェクト: steffan88/Bevelle
        private TaskState Harvest(Dwarf d, float dt, double dtd)
        {
            d.DidSomeFarming(dt);

            CropBase crop = (CropBase)d.GetActionWorldObject();
            d.CarryWorldObject(crop.TakeHarvest());

            return TaskState.Success;
        }
コード例 #7
0
ファイル: PickupTool.cs プロジェクト: steffan88/Bevelle
        private TaskState Pickup(Dwarf d, float dt, double dtd)
        {
            WorldObject tool = d.GetActionWorldObject();

            d.GetActionbuilding().WithdrawWorldObject(tool);

            //if (WorldMap.Instance.GetDeposWithTool().Count == 0)
            //    return TaskState.PersonalFail;
            //else
            //    return TaskState.PersonalFailTryBehaviorAgain;

            d.CarryWorldObject(tool);

            return TaskState.Success;
        }
コード例 #8
0
ファイル: PickupFood.cs プロジェクト: steffan88/Bevelle
        private TaskState Pickup(Dwarf d, float dt, double dtd)
        {
            WorldObject food = d.GetActionWorldObject();

            d.GetActionbuilding().WithdrawWorldObject(food);

            //if (food == null)
            //{
            //    if (WorldMap.Instance.GetDeposWithFood().Count == 0)
            //        return TaskState.PersonalFail;
            //    return TaskState.PersonalFailTryBehaviorAgain;
            //}

            d.CarryWorldObject(food);

            return TaskState.Success;
        }