コード例 #1
0
 public Harvester(Actor self, HarvesterInfo info)
 {
     Info       = info;
     mobile     = self.Trait <Mobile>();
     resLayer   = self.World.WorldActor.Trait <ResourceLayer>();
     claimLayer = self.World.WorldActor.Trait <ResourceClaimLayer>();
 }
コード例 #2
0
 public ClearsResources(ClearsResourcesInfo info, Actor self)
     : base(info)
 {
     resLayer    = self.World.WorldActor.Trait <ResourceLayer>();
     resRenderer = self.World.WorldActor.Trait <ResourceRenderer>();
     allCells    = self.World.Map.ProjectedCells.ToArray();
 }
コード例 #3
0
 protected override void TraitEnabled(Actor self)
 {
     pathfinder  = world.WorldActor.Trait <IPathFinder>();
     domainIndex = world.WorldActor.Trait <DomainIndex>();
     resLayer    = world.WorldActor.TraitOrDefault <ResourceLayer>();
     claimLayer  = world.WorldActor.TraitOrDefault <ResourceClaimLayer>();
     scanForIdleHarvestersTicks = Info.ScanForIdleHarvestersInterval;
 }
コード例 #4
0
ファイル: Harvester.cs プロジェクト: DoGyAUT/OpenRA
        public Harvester(Actor self, HarvesterInfo info)
        {
            Info       = info;
            mobile     = self.Trait <Mobile>();
            resLayer   = self.World.WorldActor.Trait <ResourceLayer>();
            claimLayer = self.World.WorldActor.Trait <ResourceClaimLayer>();

            self.QueueActivity(new CallFunc(() => ChooseNewProc(self, null)));
        }
コード例 #5
0
ファイル: Harvester.cs プロジェクト: boyuezh/OpenRA
        public Harvester(Actor self, HarvesterInfo info)
        {
            Info     = info;
            Contents = new ReadOnlyDictionary <ResourceTypeInfo, int>(contents);

            mobile     = self.Trait <Mobile>();
            resLayer   = self.World.WorldActor.Trait <ResourceLayer>();
            claimLayer = self.World.WorldActor.Trait <ResourceClaimLayer>();
        }
コード例 #6
0
        public ResourceRenderer(Actor self, ResourceRendererInfo info)
        {
            Info = info;

            ResourceLayer              = self.Trait <ResourceLayer>();
            ResourceLayer.CellChanged += AddDirtyCell;

            RenderContent = new CellLayer <RendererCellContents>(self.World.Map);
        }
コード例 #7
0
 protected override void TraitEnabled(Actor self)
 {
     requestUnitProduction = player.PlayerActor.TraitsImplementing <IBotRequestUnitProduction>().ToArray();
     pathfinder            = world.WorldActor.Trait <IPathFinder>();
     domainIndex           = world.WorldActor.Trait <DomainIndex>();
     resLayer   = world.WorldActor.TraitOrDefault <ResourceLayer>();
     claimLayer = world.WorldActor.TraitOrDefault <ResourceClaimLayer>();
     scanForIdleHarvestersTicks = Info.ScanForIdleHarvestersInterval;
 }
コード例 #8
0
        protected override void TraitEnabled(Actor self)
        {
            pathfinder  = world.WorldActor.Trait <IPathFinder>();
            domainIndex = world.WorldActor.Trait <DomainIndex>();
            resLayer    = world.WorldActor.TraitOrDefault <ResourceLayer>();
            claimLayer  = world.WorldActor.TraitOrDefault <ResourceClaimLayer>();

            // Avoid all AIs scanning for idle harvesters on the same tick, randomize their initial scan delay.
            scanForIdleHarvestersTicks = world.LocalRandom.Next(Info.ScanForIdleHarvestersInterval, Info.ScanForIdleHarvestersInterval * 2);
        }
コード例 #9
0
ファイル: SeedsResource.cs プロジェクト: Blackbird88/OpenRA
        public SeedsResource(Actor self, SeedsResourceInfo info)
        {
            this.info = info;

            resourceType = self.World.WorldActor.TraitsImplementing <ResourceType>()
                           .FirstOrDefault(t => t.Info.Name == info.ResourceType);

            if (resourceType == null)
            {
                throw new InvalidOperationException("No such resource type `{0}`".F(info.ResourceType));
            }

            resLayer = self.World.WorldActor.Trait <ResourceLayer>();
        }
コード例 #10
0
 public DecaysResource(Actor self, DecaysResourceInfo info)
     : base(info)
 {
     this._info = info;
     _resLayer  = self.World.WorldActor.Trait <ResourceLayer>();
 }