private void OnMouseDown() { ValueScript val = gameObject.GetComponentInParent(typeof(ValueScript)) as ValueScript; int amount = val.getValue(); if (amount >= cost) { amount -= cost; abilityUnlocked(); } val.setValue(amount); }
/* * Actualize the text fields with the name and country. */ public void actualizeTexts(bool force = false) { if (GameStateManager.instance.gamestate == GameStateManager.Gamestate.gameActive || force == true) { string country = getCountryTranslatedStringFromValue(); string name = GetNameString(); if (countryText != null) { countryText.text = country; } if (nameText != null) { nameText.text = name; } if (countryAndNameText != null) { countryAndNameText.text = GetCountryNameString(); } //expand this, if you want an apache helicopter. To show the apache pictogram modify the 'Gender Generator' script. gender = getNameAndGenderFromValue().gender; if (gender != null) { if (gender == genderTypes.male) { vs_gender.setValue(0f); } else if (gender == genderTypes.female) { vs_gender.setValue(1f); } } } }
void save() { SecurePlayerPrefs.SetInt(prefsKey + "_actualLevel", stats.actualLevel); SecurePlayerPrefs.SetFloat(prefsKey + "_actualXp", stats.XpActual); SecurePlayerPrefs.SetFloat(prefsKey + "_allXp", stats.XpAll); if (levelSave.saveToValue == true) { ValueScript saveVs = valueManager.instance.getFirstFittingValue(levelSave.value); if (saveVs != null) { saveVs.setValue(stats.actualLevel); } } }