question

Dmitry avatar image
Dmitry asked

The best way to implement the energy system for Unity3D

In my game, there is an energy system with a maximum value of X and a minimum of 0. When a player enters a battle, the energy decreases by 5. Every 5 minutes, the energy is restored by 1. For example, if the energy was 30 and the player entered a battle, it would become 25. After 5 minutes, it should become 26. What is the best approach to implement such a mechanic using PlayFab and Azure?

Player Dataapisunity3dIn-Game Economy
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

For energy system, you can create and use a rechargeable virtual currency (set the Recharge rate and Recharge maximum on the VC in the Economy->Currencies page in the Game Manager). And you can call Subtract User Virtual Currency API to decrease the energy when the player entered a battle. For more information about Recharge rate and Recharge maximum, you can refer to Manage Virtual Currencies in Economy (Legacy) - PlayFab | Microsoft Learn.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dmitry avatar image Dmitry commented ·

Can I modify these fields from the Azure Cloud Script? 6251-monosnap-new-currency-playfab-2023-08-08-09-48-33.png

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.