當前位置: 首頁>>代碼示例>>C#>>正文


C# Traits.PowerManager類代碼示例

本文整理匯總了C#中OpenRA.Traits.PowerManager的典型用法代碼示例。如果您正苦於以下問題:C# PowerManager類的具體用法?C# PowerManager怎麽用?C# PowerManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PowerManager類屬於OpenRA.Traits命名空間,在下文中一共展示了PowerManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Building

 public Building(ActorInitializer init)
 {
     this.self = init.self;
     this.topLeft = init.Get<LocationInit,int2>();
     this.Info = self.Info.Traits.Get<BuildingInfo>();
     this.PlayerPower = init.self.Owner.PlayerActor.Trait<PowerManager>();
 }
開發者ID:geckosoft,項目名稱:OpenRA,代碼行數:7,代碼來源:Building.cs

示例2: OreRefinery

 public OreRefinery(Actor self, OreRefineryInfo info)
 {
     this.self = self;
     Info = info;
     PlayerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
     PlayerPower = self.Owner.PlayerActor.Trait<PowerManager>();
 }
開發者ID:patthoyts,項目名稱:OpenRA,代碼行數:7,代碼來源:OreRefinery.cs

示例3: BaseBuilder

		public BaseBuilder(HackyAI ai, string category, Player p, PowerManager pm, PlayerResources pr)
		{
			this.ai = ai;
			world = p.World;
			player = p;
			playerPower = pm;
			playerResources = pr;
			this.category = category;
		}
開發者ID:JackKucan,項目名稱:OpenRA,代碼行數:9,代碼來源:BaseBuilder.cs

示例4: ProductionItem

 public ProductionItem(ProductionQueue queue, string item, int cost, PowerManager pm, Action onComplete)
 {
     Item = item;
     RemainingTime = TotalTime = 1;
     RemainingCost = TotalCost = cost;
     OnComplete = onComplete;
     Queue = queue;
     this.pm = pm;
 }
開發者ID:RobotCaleb,項目名稱:OpenRA,代碼行數:9,代碼來源:ProductionQueue.cs

示例5: BaseBuilder

		public BaseBuilder(HackyAI ai, string category, Player p, PowerManager pm, PlayerResources pr)
		{
			this.ai = ai;
			world = p.World;
			player = p;
			playerPower = pm;
			playerResources = pr;
			this.category = category;
			failRetryTicks = ai.Info.StructureProductionResumeDelay;
		}
開發者ID:Roger-luo,項目名稱:OpenRA,代碼行數:10,代碼來源:BaseBuilder.cs

示例6: Building

        public Building(ActorInitializer init)
        {
            this.self = init.self;
            this.topLeft = init.Get<LocationInit,int2>();
            Info = self.Info.Traits.Get<BuildingInfo>();
            self.CenterLocation = Game.CellSize
                * ((float2)topLeft + .5f * (float2)Info.Dimensions);

            PlayerPower = init.self.Owner.PlayerActor.Trait<PowerManager>();
        }
開發者ID:pdovy,項目名稱:OpenRA,代碼行數:10,代碼來源:Building.cs

示例7: ProductionItem

 public ProductionItem(ProductionQueue queue, string item, int cost, PowerManager pm, Action onComplete)
 {
     Item = item;
     RemainingTime = TotalTime = 1;
     RemainingCost = TotalCost = cost;
     OnComplete = onComplete;
     Queue = queue;
     this.pm = pm;
     ai = Queue.Actor.World.Map.Rules.Actors[Item];
     bi = ai.TraitInfo<BuildableInfo>();
 }
開發者ID:OpenRA,項目名稱:OpenRA,代碼行數:11,代碼來源:ProductionQueue.cs

示例8: Activate

        public void Activate(Player p)
        {
            this.p = p;
            this.world = p.World;
            GameStarted = true;

            random = new XRandom((int)p.PlayerActor.ActorID);

            SpecialPowers = p.PlayerActor.Trait<SupportPowerManager>();
            Power = p.PlayerActor.Trait<PowerManager>();
            Resources = p.PlayerActor.Trait<PlayerResources>();

            squadmanager = new SquadManager(this);

            // Initialize builders
            Builders = new List<IAIBuilder>() { new BaseBuilder(this), new DefenseBuilder(this),
                new InfantryBuilder(this), new VehicleBuilder(this),
                new AircraftBuilder(this), new ShipBuilder(this) };

            // Have the bot cheat, gets free 500 000 credits at the start of the match
            Resources.GiveCash(500000);
        }
開發者ID:Iran,項目名稱:ClassicRA,代碼行數:22,代碼來源:IranAI.cs

示例9: OnOwnerChanged

 public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
 {
     power = newOwner.PlayerActor.Trait<PowerManager>();
 }
開發者ID:CH4Code,項目名稱:OpenRA,代碼行數:4,代碼來源:PowerMultiplier.cs

示例10: PowerMultiplier

 public PowerMultiplier(Actor self, PowerMultiplierInfo info)
     : base(info, "PowerMultiplier", self.Info.Name)
 {
     power = self.Owner.PlayerActor.Trait<PowerManager>();
 }
開發者ID:CH4Code,項目名稱:OpenRA,代碼行數:5,代碼來源:PowerMultiplier.cs

示例11: ProductionQueue

        public ProductionQueue( Actor self, Actor playerActor, ProductionQueueInfo info )
        {
            this.self = self;
            this.Info = info;
            playerResources = playerActor.Trait<PlayerResources>();
            PlayerPower = playerActor.Trait<PowerManager>();

            Race = self.Owner.Country;
            Produceable = InitTech(playerActor);
        }
開發者ID:nevelis,項目名稱:OpenRA,代碼行數:10,代碼來源:ProductionQueue.cs

示例12: OnCapture

        public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
        {
            PlayerPower = newOwner.PlayerActor.Trait<PowerManager>();
            playerResources = newOwner.PlayerActor.Trait<PlayerResources>();
            ClearQueue();

            // Produceable contains the tech from the original owner - this is desired so we don't clear it.
            Produceable = InitTech(self.Owner.PlayerActor);

            // Force a third(!) tech tree update to ensure that prerequisites are correct.
            // The first two updates are triggered by adding/removing the actor when
            // changing ownership, *before* the new techtree watchers have been set up.
            // This is crap.
            self.Owner.PlayerActor.Trait<TechTree>().Update();
        }
開發者ID:nevelis,項目名稱:OpenRA,代碼行數:15,代碼來源:ProductionQueue.cs

示例13: PowerTooltip

 public PowerTooltip(Actor self)
 {
     this.self = self;
     powerManager = self.Owner.PlayerActor.Trait<PowerManager>();
     developerMode = self.Owner.PlayerActor.Trait<DeveloperMode>();
 }
開發者ID:CH4Code,項目名稱:OpenRA,代碼行數:6,代碼來源:PowerTooltip.cs

示例14: Activate

		// Called by the host's player creation code
		public void Activate(Player p)
		{
			Player = p;
			enabled = true;
			playerPower = p.PlayerActor.Trait<PowerManager>();
			supportPowerMngr = p.PlayerActor.Trait<SupportPowerManager>();
			playerResource = p.PlayerActor.Trait<PlayerResources>();

			foreach (var building in Info.BuildingQueues)
				builders.Add(new BaseBuilder(this, building, p, playerPower, playerResource));
			foreach (var defense in Info.DefenseQueues)
				builders.Add(new BaseBuilder(this, defense, p, playerPower, playerResource));

			Random = new MersenneTwister((int)p.PlayerActor.ActorID);

			// Avoid all AIs trying to rush in the same tick, randomize their initial rush a little.
			var smallFractionOfRushInterval = Info.RushInterval / 20;
			rushTicks = Random.Next(Info.RushInterval - smallFractionOfRushInterval, Info.RushInterval + smallFractionOfRushInterval);

			// Avoid all AIs reevaluating assignments on the same tick, randomize their initial evaluation delay.
			assignRolesTicks = Random.Next(0, Info.AssignRolesInterval);
			attackForceTicks = Random.Next(0, Info.AttackForceInterval);
			minAttackForceDelayTicks = Random.Next(0, Info.MinimumAttackForceDelay);

			resourceTypeIndices = new BitArray(World.TileSet.TerrainInfo.Length); // Big enough
			foreach (var t in Map.Rules.Actors["world"].TraitInfos<ResourceTypeInfo>())
				resourceTypeIndices.Set(World.TileSet.GetTerrainIndex(t.TerrainType), true);
		}
開發者ID:Roger-luo,項目名稱:OpenRA,代碼行數:29,代碼來源:HackyAI.cs

示例15: ProductionQueue

        public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info)
        {
            self = init.Self;
            Info = info;
            playerResources = playerActor.Trait<PlayerResources>();
            playerPower = playerActor.Trait<PowerManager>();
            developerMode = playerActor.Trait<DeveloperMode>();

            Faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
            Enabled = !info.Factions.Any() || info.Factions.Contains(Faction);

            CacheProducibles(playerActor);
            allProducibles = producible.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key);
            buildableProducibles = producible.Where(a => a.Value.Buildable).Select(a => a.Key);
        }
開發者ID:CH4Code,項目名稱:OpenRA,代碼行數:15,代碼來源:ProductionQueue.cs


注:本文中的OpenRA.Traits.PowerManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。