public void DisplayDefence() { for (int i = 0; i < Enum.GetValues(typeof(DefenceName)).Length; i++) { GUI.Label(new Rect(OFFSET_FROM_BASEVALUE * 2, statStartingPos + (i * LINE_HEIGHT), STAT_LABEL_WIDTH, LINE_HEIGHT), ((DefenceName)i).ToString(), fontCharGenStyling); GUI.Label(new Rect((OFFSET_FROM_BASEVALUE * 2) + STAT_LABEL_WIDTH, statStartingPos + (i * LINE_HEIGHT), BASEVALUE_LABEL_WIDTH, LINE_HEIGHT), _playerInformation.GetDefence(i).AdjustedBaseValue.ToString(), fontCharGenStyling); } }
/// <summary> /// Initilises the variables. /// </summary> public void initiliseConstantVariables() { for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) { _primaryAttribute [cnt] = ((AttributeName)cnt).ToString(); _primaryAttributeValues[cnt] = info.GetPrimaryAttribute(cnt).AdjustedBaseValue; } for (int i = 0; i < Enum.GetValues(typeof(VitalName)).Length; i++) { _vital[i] = ((VitalName)i).ToString(); _vitalValue[i] = info.GetVitals(i).AdjustedBaseValue; } for (int i = 0; i < Enum.GetValues(typeof(ManaName)).Length; i++) { _mana[i] = ((ManaName)i).ToString(); _manaValue[i] = info.GetMana(i).AdjustedBaseValue; } for (int i = 0; i < Enum.GetValues(typeof(AttackName)).Length; i++) { _attack[i] = ((AttackName)i).ToString(); _attackValue[i] = info.GetAttack(i).AdjustedBaseValue; } for (int i = 0; i < Enum.GetValues(typeof(DefenceName)).Length; i++) { _defence[i] = ((DefenceName)i).ToString(); _defenceValue[i] = info.GetDefence(i).AdjustedBaseValue; } positionOnScreen.x = PlayerPrefs.GetFloat("Position - x"); positionOnScreen.y = PlayerPrefs.GetFloat("Position - y"); positionOnScreen.z = PlayerPrefs.GetFloat("Position - z"); GameObject objGame = GameObject.FindGameObjectWithTag("Constant"); StoredInformation storedIN = objGame.GetComponent <StoredInformation>(); moneyTotal = 0; money = new MoneySystem(); if (Application.loadedLevelName == "NewGame") { level = 1; experience = 100; storedIN.level = 1; storedIN.experience = 100; storedIN.nextLevelvalue = experience * 1.2f; storedIN.nextLevel = (int)(experience * 1.2f); nextLevelvalue = experience * 1.2f; nextLevel = (int)(experience * 1.2f); moneyTotal = money.StarterMoney(); storedIN.moneyTotal = moneyTotal; } else if ((PlayerPrefs.GetInt("Money") != null) || (PlayerPrefs.GetInt("Money") != 0)) { moneyTotal = PlayerPrefs.GetInt("Money"); storedIN.moneyTotal = moneyTotal; level = PlayerPrefs.GetInt("Level"); experience = PlayerPrefs.GetInt("Experience"); storedIN.experience = experience; storedIN.level = level; if (level == 0) { level = 1; storedIN.level = 1; storedIN.experience = 100; experience = 100; } } else if (moneyTotal == 0) { moneyTotal = money.StarterMoney(); storedIN.moneyTotal = moneyTotal; } else { moneyTotal = PlayerPrefs.GetInt("Money"); storedIN.moneyTotal = moneyTotal; } info.StatUpdate(); _vitalValue = info.VitalUpdate(); _attackValue = info.AttackUpdate(); _defenceValue = info.DefenceUpdate(); _manaValue = info.ManaUpdate(); if (characterName == String.Empty) { characterName = PlayerPrefs.GetString("Player Name"); storedIN.characterName = PlayerPrefs.GetString("Player Name"); } itemsNameArray = new ArrayList(); itemsContentArray = new ArrayList(); }