FLimenUpgradeArrayItem
Overview
This struct is used within FLimenUpgradeArray to store individual upgrade items. It includes a TSubclassOf<ULimenUpgrade> property that holds the upgrade class.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TSubclassOf | Upgrade | Public | The upgrade class associated with this item. |
FLimenUpgradeArray
Overview
This struct extends FFastArraySerializer and is used to manage an array of FLimenUpgradeArrayItem. It includes a TArray<FLimenUpgradeArrayItem> property that holds the upgrade items. The NetDeltaSerialize function is overridden to enable efficient delta serialization for network replication.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TArray | Items | Public | The array of upgrade items. |
FShopRerollDelegate
Overview
This delegate is triggered when the shop is updated, providing a reference to the ULimenUpgradeShopComponent and an array of new upgrades.
Properties
None
ULimenUpgradeShopComponent
Overview
This actor component manages the upgrade shop. It includes properties for controlling the number of available upgrades, reroll cost, and a list of all possible upgrades. The component handles replication of the limited available upgrades and provides public functions to interact with the shop.
Properties
Type | Name | Access | Description |
|---|---|---|---|
FShopRerollDelegate | OnShopUpdated | Public | Delegate triggered when the shop is updated. |
bool | bOnlyAllowSpecificQuantity | EditDefaultsOnly, BlueprintReadOnly | Whether to limit the number of available upgrades. |
int32 | QuantityAvailable | EditDefaultsOnly, BlueprintReadOnly | The number of available upgrades if |
int32 | RerollCost | Replicated, EditDefaultsOnly, BlueprintReadOnly | The cost to reroll the shop. |
TArray<TSubclassOf > | AllUpgrades | EditDefaultsOnly, BlueprintReadOnly | A list of all possible upgrades. |
FLimenUpgradeArray | ReplicatedLimitedAvailableUpgrades | ReplicatedUsing="OnRep_LimitedAvailableUpgrades" | The limited available upgrades, replicated to clients. |
TArray<TSubclassOf > | LimitedAvailableUpgrades | BlueprintReadOnly, meta=(AllowPrivateAccess=true) | The limited available upgrades, accessible in blueprints. |
int32 | Rerolls | Replicated | The number of rerolls performed. |
Functions
Return Type | Signature | Description |
|---|---|---|
const TArray<TSubclassOf >& | GenerateAvailableUpgrades() | Generates and returns the available upgrades based on the current state. |
const TArray<TSubclassOf >& | GetAllUpgrades() const | Returns a reference to the list of all possible upgrades. |
bool | CanRerollShop(const ULimenCreditsComponent* CreditsComponent) const | Checks if rerolling the shop is possible with the given credits component. |
void | RerollShop(ULimenCreditsComponent* CreditsComponent) | Rerolls the shop using the given credits component. |
int32 | GetRerollCost() const | Returns the cost to reroll the shop. |
void | UpdateShop() | Updates the shop state based on the current configuration and available upgrades. |
Usage & Implementation Notes
Threading Constraints: This component is designed to be used in a single-threaded environment as it does not involve any multi-threading operations.
Replication Requirements: The
ReplicatedLimitedAvailableUpgradesandRerollsproperties are replicated to ensure that all clients have the same state of the upgrade shop.Memory Lifetime Management: The component manages memory for the limited available upgrades by clearing and repopulating the arrays as needed.
Initialization Dependencies: The component requires a valid owner with authority to perform operations such as generating available upgrades or rerolling the shop.