Ejemplo n.º 1
0
 public HarvestResource(Actor self)
 {
     harv = self.Trait<Harvester>();
     harvInfo = self.Info.Traits.Get<HarvesterInfo>();
     facing = self.Trait<IFacing>();
     territory = self.World.WorldActor.TraitOrDefault<ResourceClaimLayer>();
     resLayer = self.World.WorldActor.Trait<ResourceLayer>();
 }
Ejemplo n.º 2
0
 public FindResources(Actor self)
 {
     harv = self.Trait<Harvester>();
     harvInfo = self.Info.Traits.Get<HarvesterInfo>();
     mobile = self.Trait<Mobile>();
     mobileInfo = self.Info.Traits.Get<MobileInfo>();
     resLayer = self.World.WorldActor.Trait<ResourceLayer>();
     territory = self.World.WorldActor.TraitOrDefault<ResourceClaimLayer>();
     pathFinder = self.World.WorldActor.Trait<IPathFinder>();
 }
Ejemplo n.º 3
0
        public static bool CanHarvestAt(this Actor self, CPos pos, ResourceLayer resLayer, HarvesterInfo harvInfo,
			ResourceClaimLayer territory)
        {
            var resType = resLayer.GetResource(pos);
            if (resType == null)
                return false;

            // Can the harvester collect this kind of resource?
            if (!harvInfo.Resources.Contains(resType.Info.Type))
                return false;

            if (territory != null)
            {
                // Another harvester has claimed this resource:
                ResourceClaim claim;
                if (territory.IsClaimedByAnyoneElse(self as Actor, pos, out claim))
                    return false;
            }

            return true;
        }
Ejemplo n.º 4
0
 public DeliverResources(Actor self)
 {
     movement = self.Trait<IMove>();
     harv = self.Trait<Harvester>();
     harvInfo = self.Info.Traits.Get<HarvesterInfo>();
 }
Ejemplo n.º 5
0
 public Harvester(Actor self, HarvesterInfo info)
 {
     this.info = info;
     self.QueueActivity(new CallFunc(() => ChooseNewProc(self, null)));
 }
Ejemplo n.º 6
0
 public Harvester(Actor self, HarvesterInfo info)
 {
     this.info = info;
     mobile    = self.Trait <Mobile>();
     self.QueueActivity(new CallFunc(() => ChooseNewProc(self, null)));
 }