public UndergroundResourceRenderer(Actor self, UndergroundResourceRendererInfo info) { Info = info; ResourceLayer = self.Trait <UndergroundResourceLayer>(); ResourceLayer.CellChanged += AddDirtyCell; RenderContent = new CellLayer <RendererCellContents>(self.World.Map); }
protected override void TraitEnabled(Actor self) { // PERF: Avoid all AIs reevaluating assignments on the same tick, randomize their initial evaluation delay. scanForIdleMinersTicks = world.LocalRandom.Next(0, Info.MinimumScanDelay); pathfinder = world.WorldActor.Trait <IPathFinder>(); domainIndex = world.WorldActor.Trait <DomainIndex>(); resourceLayer = world.WorldActor.TraitOrDefault <UndergroundResourceLayer>(); requestUnitProduction = player.PlayerActor.TraitsImplementing <IBotRequestUnitProduction>().ToArray(); }
public ResourceCollector(Actor self, ResourceCollectorInfo info) : base(info) { this.info = info; Ticks = info.InitialDelay; resourceLayer = self.World.WorldActor.Trait <UndergroundResourceLayer>(); building = self.Trait <Building>(); rallyPoint = Exts.Lazy(() => self.IsDead ? null : self.TraitOrDefault <RallyPoint>()); }
public Floods(Actor self, FloodsInfo info) : base(info) { this.info = info; resourceType = self.World.WorldActor.TraitsImplementing <ResourceType>() .FirstOrDefault(t => t.Info.Type == info.ResourceType); if (resourceType == null) { throw new InvalidOperationException("No such resource type `{0}`".F(info.ResourceType)); } resourceLayer = self.World.WorldActor.Trait <UndergroundResourceLayer>(); // TODO: think of something else cells.Add(self.Location); }