Example #1
0
        protected override GameAction PrepareNextActionOverride(out JobStatus progress)
        {
            var action = new CarryItemAction(m_item);

            progress = JobStatus.Ok;
            return(action);
        }
Example #2
0
        ActionState ProcessAction(CarryItemAction action)
        {
            if (this.ActionTicksUsed == 1)
            {
                this.ActionTotalTicks = 1;
            }

            if (this.ActionTicksUsed < this.ActionTotalTicks)
            {
                return(ActionState.Ok);
            }

            var item = this.World.FindObject <ItemObject>(action.ItemID);

            var report = new CarryItemActionReport(this, item);

            if (item == null)
            {
                SendFailReport(report, "item not found");
                return(ActionState.Fail);
            }

            if (this.CarriedItem != null)
            {
                SendFailReport(report, "already carrying an item");
                return(ActionState.Fail);
            }

            if (item.Environment != this.Environment || item.Location != this.Location)
            {
                SendFailReport(report, "item not there");
                return(ActionState.Fail);
            }

            if (item.MoveTo(this) == false)
            {
                SendFailReport(report, "failed to move");
                return(ActionState.Fail);
            }

            this.CarriedItem = item;

            SendReport(report);

            return(ActionState.Done);
        }
Example #3
0
        ActionState ProcessAction(CarryItemAction action)
        {
            if (this.ActionTicksUsed == 1)
                this.ActionTotalTicks = 1;

            if (this.ActionTicksUsed < this.ActionTotalTicks)
                return ActionState.Ok;

            var item = this.World.FindObject<ItemObject>(action.ItemID);

            var report = new CarryItemActionReport(this, item);

            if (item == null)
            {
                SendFailReport(report, "item not found");
                return ActionState.Fail;
            }

            if (this.CarriedItem != null)
            {
                SendFailReport(report, "already carrying an item");
                return ActionState.Fail;
            }

            if (item.Environment != this.Environment || item.Location != this.Location)
            {
                SendFailReport(report, "item not there");
                return ActionState.Fail;
            }

            if (item.MoveTo(this) == false)
            {
                SendFailReport(report, "failed to move");
                return ActionState.Fail;
            }

            this.CarriedItem = item;

            SendReport(report);

            return ActionState.Done;
        }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     Ground     = false;
     itemAction = GetComponent <CarryItemAction>();
 }
Example #5
0
 protected override GameAction PrepareNextActionOverride(out JobStatus progress)
 {
     var action = new CarryItemAction(m_item);
     progress = JobStatus.Ok;
     return action;
 }