Ejemplo n.º 1
0
 public void OnDock(Actor harv, DeliverResources dockOrder)
 {
     // Todo: need to be careful about cancellation and multiple harvs
     harv.QueueActivity(new Move(self.Location + new int2(1,1), self));
     harv.QueueActivity(new Turn(96));
     harv.QueueActivity( new CallFunc( () =>
         self.traits.Get<RenderBuilding>().PlayCustomAnimThen(self, "active", () => {
             harv.traits.Get<Harvester>().Deliver(harv, self);
             harv.QueueActivity(new Move(self.Location + DeliverOffset, self));
             harv.QueueActivity(new Harvest());
     })));
 }
Ejemplo n.º 2
0
        public void OnDock(Actor harv, DeliverResources dockOrder)
        {
            var unit = harv.traits.Get<Unit>();
            if (unit.Facing != 64)
                harv.QueueActivity(new Turn(64));

            harv.QueueActivity( new CallFunc( () => {
                var renderUnit = harv.traits.Get<RenderUnit>();
                if (renderUnit.anim.CurrentSequence.Name != "empty")
                    renderUnit.PlayCustomAnimation(harv, "empty", () =>
                    {
                        harv.traits.Get<Harvester>().Deliver(harv, self);
                        harv.QueueActivity(new Harvest());
                    });
                }
            ));
        }
Ejemplo n.º 3
0
 public void OnDock(Actor harv, DeliverResources dockOrder)
 {
     if (!preventDock)
     {
         harv.QueueActivity( new CallFunc( () => dockedHarv = harv, false ) );
         harv.QueueActivity( DockSequence(harv, self) );
         harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
     }
     harv.QueueActivity( new CallFunc( () => harv.Trait<Harvester>().ContinueHarvesting(harv) ) );
 }
Ejemplo n.º 4
0
        public void OnDock(Actor harv, DeliverResources dockOrder)
        {
            var mobile = harv.Trait<Mobile>();
            var harvester = harv.Trait<Harvester>();

            if (!preventDock)
            {
                harv.QueueActivity( new CallFunc( () => dockedHarv = harv, false ) );
                harv.QueueActivity( DockSequence(harv, self) );
                harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) );
            }

            // Tell the harvester to start harvesting
            // TODO: This belongs on the harv idle activity
            harv.QueueActivity( new CallFunc( () =>
            {
                if (harvester.LastHarvestedCell != int2.Zero)
                {
                    harv.QueueActivity( mobile.MoveTo(harvester.LastHarvestedCell, 5) );
                    harv.SetTargetLine(Target.FromCell(harvester.LastHarvestedCell), Color.Red, false);
                }
                harv.QueueActivity( new Harvest() );
            }));
        }
Ejemplo n.º 5
0
 public void OnDock(Actor harv, DeliverResources dockOrder)
 {
     self.Trait<IAcceptOreDockAction>().OnDock(self, harv, dockOrder);
 }