示例#1
0
        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();
        }
示例#3
0
        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>());
        }
示例#4
0
        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);
        }