UnityHathor is a class that allows Unity to talk directly to your Headless Hathor Wallet, so you can make any kind of transaction
- Unity 2020.3.3f1 (64-bit)
- Start a wallet
- Check wallet balance
- Send tokens to a specific wallet
- Wallet status
- Copy the repository to your projecy
- Dragg the prefab "HathorCountFloatingText" to your scene
- Add the HathorPlayer script to your main character
- In your character, go to the inspector and add the player wallet in the field "Wallet Player"
- In your HathorPlayer.cs add your o x_wallet_id e passphrase from where the tokens are coming from
- In your enemies or OnDeath/OnDestroy functions add the code below:
//Hathor - Using namespace
using UnityHathor;
//Hathor - Start Variables Block
public GameObject hathorCountPopup;
public GameObject playerObject;
//Hathor - End Variables Block
// Inside your death or destroy functions
// Hathor - Grab the wallet inserted in the character wallet
var walletPlayer = playerObject.GetComponent<HathorPlayer>().walletPlayer;
// generate a random value between 0 and 5 where 5 is 0.05 Hathor Coin
int hathorAmount = UnityEngine.Random.Range(0, 5);
// Hathor - Check if hathorCountPopup is no null
if (hathorCountPopup)
{
// Hathor - SHows the amount of coind received
HathorQueue.ShowHathorCountPopup(hathorCountPopup, hathorAmount, transform);
}
// Hathor - If the value is below or equal zero, do not attempt to transact
if (hathorAmount > 0)
{
// Hathor - Create a new struct with the player wallet and the value to be transacted
HathorTransactStruct newTransact = new HathorTransactStruct(walletPlayer, hathorAmount);
// Hathor - Add the new struct to the transaction queue
HathorQueue.transactsQueue.Enqueue(newTransact);
}
7 - Go to folder: Assets -> 3DGameKit -> Prefabs -> Characters -> Enemies -> Chomper 8 - Click on the chomper and in the inspector screen, you will see two fields that will be None: Hathor Count Popoup and Player Object 9 - Click on the button to the right of None and choose the Prefab HathorCountPopoup and Ellen respectively 10 - Change the HathorPlayer.cs script with the wallet id and passphrase of the server wallet, it is the wallet that will have the tokens that will be given to the players
Hathor: HSC2KhChyZfHRLwTAwjc6bqqfebtvsL3xY
BSD
Free Software, Hell Yeah!