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>();
 }
 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>();
 }
Exemple #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;
        }
 public DeliverResources(Actor self)
 {
     movement = self.Trait<IMove>();
     harv = self.Trait<Harvester>();
     harvInfo = self.Info.Traits.Get<HarvesterInfo>();
 }
Exemple #5
0
 public Harvester(Actor self, HarvesterInfo info)
 {
     this.info = info;
     self.QueueActivity(new CallFunc(() => ChooseNewProc(self, null)));
 }
Exemple #6
0
 public Harvester(Actor self, HarvesterInfo info)
 {
     this.info = info;
     mobile    = self.Trait <Mobile>();
     self.QueueActivity(new CallFunc(() => ChooseNewProc(self, null)));
 }