public override State OnReachedTarget()
        {
            GridActor[] actors = GridActorMap.GetGridActors(this.request.PositionToMoveTo);
            foreach (GridActor actor in actors)
            {
                if (actor.Guid.Equals(this.request.TargetGuid))
                {
                    logger.Log("Found my target GridActor, giving it my item");

                    InventoryComponent inventory = actor.GetComponent <InventoryComponent>();
                    if (inventory)
                    {
                        inventory.AddItem(item);
                        MoveItemRequestPool.Instance.FinishRequest(request);
                    }
                    else
                    {
                        MoveItemRequestPool.Instance.CancelRequest(request);
                        logger.Log("My target GridActor did not have an inventory", LogLevel.Error);
                    }
                    TerminateMachine();
                    return(StateMachine.NoTransition());
                }
            }
            logger.Log("Did not find my target GridActor at the target, dropping my item");
            DroppedItemManager.PutItem(this.request.PositionToMoveTo, item);
            return(OnPathFindFail());
        }
 public override State OnPathFindFail()
 {
     logger.Log("MoveItemJob, WalkToTargetState, OnPathFindFail " + GetFailReason().ToString());
     logger.Log("Dropping my item");
     TerminateMachine();
     DroppedItemManager.PutItem(actor.Position, item);
     MoveItemRequestPool.Instance.ReturnRequest(request);
     return(StateMachine.NoTransition());
 }
 private void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     else if (instance && instance != this)
     {
         Destroy(this);
     }
 }
        public override State OnReachedTarget()
        {
            var item = DroppedItemManager.GetItem(actor.Position, request.TypeToFind);

            if (item != null)
            {
                logger.Log("Found my item at " + actor.Position);
                return(new WalkToTargetState(this.actor, request, item, logger));
            }
            logger.Log("MoveItemJob, no item at target");
            return(OnPathFindFail());
        }