Skip to content

Commit

Permalink
feat: craft skin
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed May 29, 2024
1 parent 5a102fe commit 888dce8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Assets/Shared/Scripts/UI/LevelCompleteScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,17 @@ private async void OnTryAgainButtonClicked()

private void OnNextButtonClicked()
{
m_NextLevelEvent.Raise();
// Check if the player is already using a new skin
if (!SaveManager.Instance.UseNewSkin)
{
// Player is not using a new skin, take player to Unlocked Skin screen
m_UnlockedSkinEvent.Raise();
}
else
{
// Player is already using a new skin, take player to the next level
m_NextLevelEvent.Raise();
}
}

private void ShowCompletedContainer(bool show)
Expand Down
10 changes: 9 additions & 1 deletion Assets/Shared/Scripts/UI/UnlockedSkinScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Immutable.Passport;
using Immutable.Passport.Model;

namespace HyperCasual.Runner
{
Expand Down Expand Up @@ -116,7 +118,13 @@ private async void Craft()
m_CraftState = CraftSkinState.Crafting;

// Burn tokens and mint a new skin i.e. crafting a skin
await Task.Delay(TimeSpan.FromSeconds(5));
string transactionHash = await Passport.Instance.ZkEvmSendTransaction(new TransactionRequest()
{
to = "YOUR_IMMUTABLE_RUNNER_TOKEN_CONTRACT_ADDRESS", // Immutable Runner Token contract address
data = "0x1e957f1e", // Call craftSkin() in the contract
value = "0"
});
Debug.Log($"Craft transaction hash: {transactionHash}");

m_CraftState = CraftSkinState.Crafted;

Expand Down

0 comments on commit 888dce8

Please sign in to comment.