I am also trying to add an in-game currency and a sprite store. in my version of the game,when you finish all the levels (there are 10 levels) you will be awarded with 10 coins. then you can enter a item store with multiple stripes for the ball. I have a problem however in awarding 10 coins to the player as I do not know how to change my if statement to a bool
‘’’
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CurrencyController : MonoBehaviour {
public LevelManager LevelManager;
public int coins;
public Text coinsDisplay;
void Awake ()
{
UpdateCurrencyUI ();
}
void Update ()
{
AddCurrency (10);
}
void AddCurrency (int amount)
{
if (LevelManager.LoadLevel("Congrats")){
coins += amount;
Debug.Log ("You now have " + coins.ToString() + " coins!");
UpdateCurrencyUI ();
}
}
void RemoveCurrency (int amount)
{
coins -= amount;
UpdateCurrencyUI ();
}
void UpdateCurrencyUI ()
{
coinsDisplay.text = coins.ToString();
}
}’’’
it does not recognize the" if (levelmanager.loadlevel) code