当前位置: 首页>>代码示例>>C#>>正文


C# Traits.PlayerResources类代码示例

本文整理汇总了C#中OpenRA.Traits.PlayerResources的典型用法代码示例。如果您正苦于以下问题:C# PlayerResources类的具体用法?C# PlayerResources怎么用?C# PlayerResources使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PlayerResources类属于OpenRA.Traits命名空间,在下文中一共展示了PlayerResources类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Sell

 public Sell(Actor self)
 {
     health = self.TraitOrDefault<Health>();
     sellableInfo = self.Info.TraitInfo<SellableInfo>();
     playerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
     IsInterruptible = false;
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:7,代码来源:Sell.cs

示例2: OreRefinery

 public OreRefinery(Actor self, OreRefineryInfo info)
 {
     this.self = self;
     Info = info;
     PlayerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
     currentDisplayTick = Info.TickRate;
 }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:7,代码来源:OreRefinery.cs

示例3: OreRefinery

 public OreRefinery(Actor self, OreRefineryInfo info)
 {
     this.self = self;
     Info = info;
     Player = self.Owner.PlayerActor.Trait<PlayerResources> ();
     LinkedHarv = new List<Actor> ();
 }
开发者ID:mgatland,项目名称:OpenRA,代码行数:7,代码来源:OreRefinery.cs

示例4: OnCapture

 public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
 {
     var ore = Stored;
     Player.TakeOre(ore);
     Player = newOwner.PlayerActor.Trait<PlayerResources>();
     Player.GiveOre(ore);
 }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:7,代码来源:StoresOre.cs

示例5: 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

示例6: Tick

        public void Tick(PlayerResources pr)
        {
            if (Done)
            {
                if (OnComplete != null) OnComplete();
                return;
            }

            if (Paused) return;

            if (pm.PowerState != PowerState.Normal)
            {
                if (--slowdown <= 0)
                    slowdown = Queue.Info.LowPowerSlowdown;
                else
                    return;
            }

            var costThisFrame = RemainingCost / RemainingTime;
            if (costThisFrame != 0 && !pr.TakeCash(costThisFrame)) return;
            RemainingCost -= costThisFrame;
            RemainingTime -= 1;
            if (RemainingTime > 0) return;

            Done = true;
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:26,代码来源:ProductionQueue.cs

示例7:

        void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            if (Info.UseFuelReserve)
                fueltank = newOwner.PlayerActor.Trait<Fueltank>();

            resources = newOwner.PlayerActor.TraitOrDefault<PlayerResources>();
        }
开发者ID:obrakmann,项目名称:oramod-wargame,代码行数:7,代码来源:FuelGenerator.cs

示例8: 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

示例9: FuelGenerator

        public FuelGenerator(Actor self, FuelGeneratorInfo info)
        {
            Info = info;

            var source = info.UseFuelReserve ? self.Owner.PlayerActor : self;
            fueltank = source.Trait<Fueltank>();
            resources = self.Owner.PlayerActor.TraitOrDefault<PlayerResources>();
            ticks = info.Interval;
        }
开发者ID:obrakmann,项目名称:oramod-wargame,代码行数:9,代码来源:FuelGenerator.cs

示例10: 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

示例11: IngameCashCounterLogic

        public IngameCashCounterLogic(Widget widget, World world)
        {
            var cash = widget.Get<LabelWithTooltipWidget>("CASH");

            this.world = world;
            player = world.LocalPlayer;
            playerResources = player.PlayerActor.Trait<PlayerResources>();
            displayResources = playerResources.Cash + playerResources.Resources;
            cashLabel = cash.Text;
            displayLabel = cashLabel.F(displayResources);

            cash.GetText = () => displayLabel;
            cash.GetTooltipText = () => "Silo Usage: {0}/{1}".F(playerResources.Resources, playerResources.ResourceCapacity);
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:14,代码来源:IngameCashCounterLogic.cs

示例12: RenderBuildingRefinery

        public RenderBuildingRefinery(ActorInitializer init, RenderBuildingInfo info)
            : base(init, info)
        {
            playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();

            lights = new Animation(GetImage(init.self));
            lights.PlayFetchIndex("lights",
                () => playerResources.OreCapacity != 0
                    ? (59 * playerResources.Ore) / (10 * playerResources.OreCapacity)
                    : 0);

            var offset = new float2(-32,-21);
            anims.Add("lights", new AnimationWithOffset( lights, wr => offset, () => !buildComplete )
                { ZOffset = 24 });
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:15,代码来源:RenderBuildingRefinery.cs

示例13: 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

示例14: OnCapture

 public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
 {
     playerResources = newOwner.PlayerActor.Trait<PlayerResources>();
 }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:4,代码来源:RenderBuildingSilo.cs

示例15: StoresResources

		public StoresResources(Actor self, StoresResourcesInfo info)
		{
			player = self.Owner.PlayerActor.Trait<PlayerResources>();
			this.info = info;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:5,代码来源:StoresResources.cs


注:本文中的OpenRA.Traits.PlayerResources类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。