-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolanaHandler.cs
66 lines (54 loc) · 1.7 KB
/
SolanaHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class SolanaHandler : MonoBehaviour {
public float sol;
/// <summary>
/// mint: E6Z6zLzk8MWY3TY8E87mr88FhGowEPJTeMWzkqtL6qkF
/// </summary>
public float usdc;
/// <summary>
/// mint: C6kYXcaRUMqeBF5fhg165RWU7AnpT9z92fvKNoMqjmz6
/// </summary>
public float btc;
public bool walletConnected;
private bool playEnabled = false;
public TextMeshProUGUI toastText;
public GameObject playButton;
public GameObject mainCanvas;
public GameObject walletHolder;
public SpawnEnemies spawner;
void Start(){
toastText.text = "Connect a wallet to play";
}
void Update() {
}
public void checkState() {
if (!walletConnected) {
playEnabled = false;
toastText.text = "Connect a wallet to play";
}else if (sol < 1) {
playEnabled = false;
toastText.text = "You must have a balance of 1 lamport to play";
}else if(usdc < 1) {
playEnabled = true;
toastText.text = "You can play, but you must hold 1 usdc to use fireballs. Try refreshing!";
} else {
playEnabled = true;
toastText.text = "Ready to play!";
}
if (playEnabled) {
playButton.SetActive(true);
} else {
playButton.SetActive(false);
}
}
public void onPlayButton() {
if (playEnabled) {
walletHolder.SetActive(false);
mainCanvas.SetActive(false);
spawner.isPaused = false;
}
}
}