本文整理汇总了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;
}
示例2: OreRefinery
public OreRefinery(Actor self, OreRefineryInfo info)
{
this.self = self;
Info = info;
PlayerResources = self.Owner.PlayerActor.Trait<PlayerResources>();
currentDisplayTick = Info.TickRate;
}
示例3: OreRefinery
public OreRefinery(Actor self, OreRefineryInfo info)
{
this.self = self;
Info = info;
Player = self.Owner.PlayerActor.Trait<PlayerResources> ();
LinkedHarv = new List<Actor> ();
}
示例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);
}
示例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>();
}
示例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;
}
示例7:
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
if (Info.UseFuelReserve)
fueltank = newOwner.PlayerActor.Trait<Fueltank>();
resources = newOwner.PlayerActor.TraitOrDefault<PlayerResources>();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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 });
}
示例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);
}
示例14: OnCapture
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
{
playerResources = newOwner.PlayerActor.Trait<PlayerResources>();
}
示例15: StoresResources
public StoresResources(Actor self, StoresResourcesInfo info)
{
player = self.Owner.PlayerActor.Trait<PlayerResources>();
this.info = info;
}