public void Tick(PlayerResources pr) { if (!Started) { var time = Queue.GetBuildTime(ai, bi); Started = true; } 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, true)) { return; } RemainingCost -= costThisFrame; RemainingTime -= 1; if (RemainingTime > 0) { return; } Done = true; }
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; IsValidFaction = !info.Factions.Any() || info.Factions.Contains(Faction); Enabled = IsValidFaction; 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); }
public ResourceStorageWarning(Actor self, ResourceStorageWarningInfo info) { this.info = info; resources = self.Trait <PlayerResources>(); }
public WithSiloAnimation(ActorInitializer init, WithSiloAnimationInfo info) { this.info = info; wsb = init.Self.Trait <WithSpriteBody>(); playerResources = init.Self.Owner.PlayerActor.Trait <PlayerResources>(); }
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { player = newOwner.PlayerActor.Trait <PlayerResources>(); }
public StoresResources(Actor self, StoresResourcesInfo info) { this.info = info; player = self.Owner.PlayerActor.Trait <PlayerResources>(); }