public override void OnInspectorGUI() { DrawDefaultInspector(); PersistentScript myScript = (PersistentScript)target; if (GUILayout.Button("Reset All")) { PlayerPrefs.DeleteAll(); PlayerPrefs.SetFloat("SFXVolume", 20); myScript.checkTimeRunning(); } if (GUILayout.Button("Reset Highscore")) { myScript.resetHighscore(); } if (GUILayout.Button(new GUIContent("Reset SFX Volume", "Only functional on Main Menu"))) { myScript.resetSFXVolume(); } if (GUILayout.Button(new GUIContent("Reset Volume", "Only functional on Main Menu"))) { myScript.resetVolume(); } if (GUILayout.Button("Set to first run")) { PlayerPrefs.SetInt("HasPlayed", 0); myScript.checkTimeRunning(); } }
public void SetUnequipData(PersistentScript persistent, string id, int location) { _persistent = persistent; _data = new InventoryItem(); _data._id = id; _location = location; }
void Start() { _persistent = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>(); _potionShop = GameObject.FindGameObjectWithTag("Potion").GetComponent <PotionShopScript>(); _databse = GameObject.FindGameObjectWithTag("Persistent").GetComponent <ItemDatabase>(); LoadPotions(); }
public void ReveiveRewards() { int rand = Random.Range(0, 100); PersistentScript per = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>(); per._gold += _enemy.Gold; per._heat += _enemy.Heat; per._magic += _enemy.Essence; if (rand > 90) { print("Got a rare"); per.AddInvenotryItem(_enemy.RareID, 1); return; } if (rand > 80) { print("Get a common"); per.AddInvenotryItem(_enemy.CommonID, 1); return; } print("No item"); }
void Start() { _smithy = GameObject.FindGameObjectWithTag("Smithy").GetComponent <SmityScript>(); _persistent = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>(); _databse = GameObject.FindGameObjectWithTag("Persistent").GetComponent <ItemDatabase>(); LoadInSmithyItems(); }
void Start() { _cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); _persistent = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>(); _database = GameObject.FindGameObjectWithTag("Persistent").GetComponent <ItemDatabase>(); LoadInItems(); GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>().LoadInventoryButton(); }
// Use this for initialization void Start() { if (m_inst == null) { m_inst = this; DontDestroyOnLoad(gameObject); } }
private void Awake() { instance = this; aSource = this.GetComponent <AudioSource>(); ExtLibControl.OnCommandCalled += UserActionControl; tasksToDisp = TaskQueueList.childCount - 1; TaskQueueList.parent.GetComponent <Toggle>().onValueChanged .AddListener(v => { PersistentScript.ClickSfx(); TaskQueueList.gameObject.SetActive(v); if (v) { UpdateTaskQueueList(); } }); //tasklist FileMenuContent = FileMenu.GetChild(0).GetChild(0); FileMenu.GetComponentInChildren <TextMeshProUGUI>().text = PersistentScript.currentMap?.name + "-Menu"; FileMenu.GetComponent <Toggle>().onValueChanged //FileMenuButton .AddListener(v => { PersistentScript.ClickSfx(); FileMenuContent.gameObject.SetActive(v); }); FileMenuContent.GetChild(0).GetComponent <Toggle>().onValueChanged //PauseButton .AddListener(v => { PersistentScript.ClickSfx(); PauseLevel(v); }); FileMenuContent.GetChild(1).GetComponent <Toggle>().onValueChanged //RestartButton .AddListener(v => { PersistentScript.ClickSfx(); ReloadLevel(); }); FileMenuContent.GetChild(2).GetComponent <Toggle>().onValueChanged //NewFileButton .AddListener(v => { PersistentScript.ClickSfx(); NewFile(); }); FileMenuContent.GetChild(3).GetComponent <Toggle>().onValueChanged //MainMenuButton .AddListener(delegate { PersistentScript.ClickSfx(); SceneManager.LoadScene(0); PersistentScript.currentMap = null; }); //MessageBox MessageBoxOkButton.onClick.AddListener(delegate { PersistentScript.ClickSfx(); MessageBox.gameObject.SetActive(false); PauseLevel(false); PersistentScript.incomingMessage = null; }); //GameoverBox GameOverBoxSendButton.onClick.AddListener(delegate { PersistentScript.ClickSfx(); GameOverBox.gameObject.SetActive(false); if (PersistentScript.usr != null) { instance.GameOverBoxInput.text = PersistentScript.usr.givenName; } var name = instance.GameOverBoxInput.text; if (!string.IsNullOrEmpty(name)) { name = name.Replace('*', ' ').Replace('|', ' '); Highscores.AddNewHighscore(name + "§§" + DateTime.Now.ToOADate() + "§§" + PersistentScript.userSecretValue, (int)PersistentScript.lastScore); } ReloadLevel();/*send score*/ }); //{ name = name.Replace('*', ' ').Replace('|', ' '); Highscores.AddNewHighscore(name + "§§" + DateTime.Now.ToOADate(), (int)PersistentScript.lastScore); } }
private void Awake() { if (instance == null) // { instance = this; DontDestroyOnLoad(gameObject); gameObject.AddComponent <Highscores>(); } //garante que só tenha um desse script na cena else { Destroy(gameObject); // } ExtLibControl.OnCommandCalled += UserActionsControl; //cahamado sempre que a proxima ação da fila é liberada }
// Create a singleton private void Awake() { if (control == null) { // DontDestroyOnLoad(gameObject); => Replace by BinaryFormatter control = this; } else { Destroy(gameObject); } }
public static bool runningFirstTime; // access to toggle first run actions // Use this for initialization void Awake() { checkTimeRunning(); // Makes sure there are not multiple persistent objects at once in one scene. if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(gameObject); } }
void Start() { _persistent = GameObject.FindGameObjectWithTag("Persistent").GetComponent <PersistentScript>(); }
public void SetButtonValue(PersistentScript persistent, InventoryItem data) { _persistent = persistent; _data = data; }