Question by
minegas123 · Aug 06, 2020 at 09:25 AM ·
currency
,Hey guys how can i get exact amount of currency when i kill enemy ?
Hey guys could you please help me ? iam trying to get exact amount of currency "coins" when my player kill enemy this is my script
public class GameController : MonoBehaviour
public Text coinCurrency;
public static int coins;
private void Awake()
{
enemycontroller = GameObject.FindObjectOfType<EnemyController>();
}
void Update()
{
coinCurrency.text = coins.ToString();
}
ANOTHER SCRIPT (enemycontroller where is death function)
public int coinDropAmount; <THIS IS MY EXACT AMOUNT OF CURRENCY THAT I WANT TO GET FROM ENEMY
public void Death()
{
if (health <= 0)
{
Debug.Log("enemytakeddamage");
THERE SHUOLD BE SOMETHING TO GET THAT CURRENCY I GUESS
Destroy(gameObject, 1f);
}
THANKS FOR HELP <3
Comment