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>(); }
public HarvesterDockSequence(Actor self, Actor refinery, int dockAngle, bool isDragRequired, WVec dragOffset, int dragLength) { dockingState = State.Turn; Refinery = refinery; DockAngle = dockAngle; IsDragRequired = isDragRequired; DragOffset = dragOffset; DragLength = dragLength; Harv = self.Trait<Harvester>(); StartDrag = self.CenterPosition; EndDrag = refinery.CenterPosition + DragOffset; }
CPos FindNextResource(Actor actor, Harvester harv) { var locomotorInfo = actor.Info.TraitInfo <MobileInfo>().LocomotorInfo; Func <CPos, bool> isValidResource = cell => domainIndex.IsPassable(actor.Location, cell, locomotorInfo) && harv.CanHarvestCell(actor, cell) && claimLayer.CanClaimCell(actor, cell); var path = pathfinder.FindPath( PathSearch.Search(world, locomotorInfo, actor, true, isValidResource) .WithCustomCost(loc => world.FindActorsInCircle(world.Map.CenterOfCell(loc), Info.HarvesterEnemyAvoidanceRadius) .Where(u => !u.IsDead && actor.Owner.Stances[u.Owner] == Stance.Enemy) .Sum(u => Math.Max(WDist.Zero.Length, Info.HarvesterEnemyAvoidanceRadius.Length - (world.Map.CenterOfCell(loc) - u.CenterPosition).Length))) .FromPoint(actor.Location)); if (path.Count == 0) { return(CPos.Zero); } return(path[0]); }
public DeliverResources(Actor self) { movement = self.Trait<IMove>(); harv = self.Trait<Harvester>(); }
public WithHarvestAnimation(ActorInitializer init, WithHarvestAnimationInfo info) { Info = info; harv = init.Self.Trait <Harvester>(); wsb = init.Self.Trait <WithSpriteBody>(); }
public DeliverResources(Actor self) { movement = self.Trait<IMove>(); harv = self.Trait<Harvester>(); IsInterruptible = false; }
public DeliverResources(Actor self) { movement = self.Trait<IMove>(); harv = self.Trait<Harvester>(); harvInfo = self.Info.Traits.Get<HarvesterInfo>(); }