public void TallyStatBuffs() { ModifiedStats stats = GetComponent <ModifiedStats>(); int dexBuff = 0; int strBuff = 0; int intBuff = 0; int armorBuff = 0; for (int x = 0; x < equippedItems.Length; x++) { if (equippedItems[x] != null) { dexBuff += equippedItems[x].dexBoost; strBuff += equippedItems[x].strBoost; intBuff += equippedItems[x].intBoost; armorBuff += equippedItems[x].armorClass; } } stats._buffDEX = dexBuff; stats._buffSTR = strBuff; stats._buffINT = intBuff; stats._armorClass = armorBuff; if (equippedItems[3] != null) { stats._baseDamage = equippedItems[3].damage; } else { stats._baseDamage = 0; } }
// ------------------------------------------------------------------------------------------------------------ // Equip the initial gear, but give time to generate the item list void WaitToEquip() { if (timeToLoad >= timeToEquip) { ModifiedStats stats = GetComponent <ModifiedStats>(); int dexBuff = 0; int strBuff = 0; int intBuff = 0; int armorBuff = 0; equippedItems[1] = completeItemList.commonArmor[0]; equippedItems[2] = completeItemList.commonArmor[1]; if (stats.bBer) { equippedItems[3] = completeItemList.commonWeapons[0]; } else if (stats.bNec) { equippedItems[3] = completeItemList.commonWeapons[1]; } else if (stats.bRan) { equippedItems[3] = completeItemList.commonWeapons[2]; } for (int x = 0; x < equippedItems.Length; x++) { if (equippedItems[x] != null) { dexBuff += equippedItems[x].dexBoost; strBuff += equippedItems[x].strBoost; intBuff += equippedItems[x].intBoost; armorBuff += equippedItems[x].armorClass; } } stats._buffDEX = dexBuff; stats._buffSTR = strBuff; stats._buffINT = intBuff; stats._armorClass = armorBuff; if (equippedItems[3] != null) { stats._baseDamage = equippedItems[3].damage; } initialEquip = true; timeToLoad = 0f; } else { timeToLoad += Time.deltaTime; } }
public virtual void Initialise() { // Add the modifier layer to the stats.. _stats = new ModifiedStats(baseStats); // Set up modifiers. intercepts = new Dictionary <Intercept, List <Effect> >(); // Initialise the RNG. rng = new System.Random(); }
public virtual void Initialise() { // Add the modifier layer to the stats.. _stats = new ModifiedStats(baseStats); // Set up modifiers. intercepts = new Dictionary<Intercept, List<Effect>>(); // Initialise the RNG. rng = new System.Random(); }
// Update is called once per frame void Update() { if (level < 25) { ModifiedStats exp = GetComponent <ModifiedStats>(); if (exp.experience >= exp.expToLevel) { LevelUp(); exp.expToLevel += (int)(exp.expToLevel * .7); } } }
// ------------------------------------------------------------------------------------------------------------ // The inventory window public void InventoryWindow(int ID) { ModifiedStats stats = GetComponent <ModifiedStats>(); int lvlToDisplay = stats.level; int dexToDisplay = stats.TotalDEX(); int strToDisplay = stats.TotalSTR(); int intToDisplay = stats.TotalINT(); int armorToDisplay = stats._armorClass; float dmgToDisplay = stats._baseDamage; int cnt = 0; berserkerTex = Resources.Load("Character2D/Berzerker Sprite") as Texture2D; // Drawing the selection buttons to view different types of items in the inventory for (int topRow = 0; topRow < selectorRows; topRow++) { // Handle which selector button is pressed if (GUI.Button(new Rect(35 + (topRow * selectorWidth), 20, selectorWidth, selectorHeight), "" + Selector[topRow])) { if (Selector[topRow] == "Equipped") { // Show the equipped items bShowEquipped = true; // Hide others bShowArmor = false; bShowItems = false; bShowWeapons = false; } else if (Selector[topRow] == "Items") { // Show the general items bShowItems = true; // Hide others bShowArmor = false; bShowEquipped = false; bShowWeapons = false; } else if (Selector[topRow] == "Armor") { // Show the armor items bShowArmor = true; // Hide others bShowItems = false; bShowEquipped = false; bShowWeapons = false; } else if (Selector[topRow] == "Weapons") { // Show the weapon items bShowWeapons = true; // Hide others bShowItems = false; bShowEquipped = false; bShowArmor = false; } clickedItem = null; displayDelete = false; //placeInList = null; } } // if we want to show the currently equipped items if (bShowEquipped) { GUI.Label(new Rect(22, 65, buttonWidth, buttonHeight), "Armor"); GUI.Label(new Rect(200, 65, 50, buttonHeight), "Weapon"); GUI.Label(new Rect(150, 145, 100, 25), "Player Stats", "box"); GUI.Label(new Rect(25, 180, 100, 25), "Level: " + lvlToDisplay); GUI.Label(new Rect(25, 195, 100, 25), "Dex: " + dexToDisplay); GUI.Label(new Rect(25, 210, 100, 25), "Str: " + strToDisplay); GUI.Label(new Rect(25, 225, 100, 25), "Int: " + intToDisplay); GUI.Label(new Rect(25, 240, 100, 25), "Defense: " + armorToDisplay); GUI.Label(new Rect(25, 255, 100, 25), "Damage: " + dmgToDisplay); //GUI.DrawTexture ( new Rect ( 250, 180, berserkerTex.width, berserkerTex.height ), berserkerTex ); for (int x = 0; x < equippedItems.Length; x++) { // if we have items to show if (equippedItems[x] != null) { if (x == 3) { if (GUI.Button(new Rect(200, 85, buttonWidth, buttonHeight), x.ToString())) { clickedItem = equippedItems[x]; placeInList = x; displayDelete = false; } } else { if (GUI.Button(new Rect(20 + (x * buttonWidth), 85, buttonWidth, buttonHeight), x.ToString())) { clickedItem = equippedItems[x]; placeInList = x; displayDelete = false; } } } // we dont have items to show else { if (x == 3) { GUI.Label(new Rect(200, 85, buttonWidth, buttonHeight), "none", "box"); } else { GUI.Label(new Rect(20 + (x * buttonWidth), 85, buttonWidth, buttonHeight), "none", "box"); } } } } // if we want to show the general items that arent currently equipped if (bShowItems) { for (int y = 0; y < inventoryRows; y++) { for (int x = 0; x < inventoryCols; x++) { // if we have items to show if (cnt < items.Count) { GUI.Button(new Rect(20 + (x * buttonWidth), 65 + (y * buttonHeight), buttonWidth, buttonHeight), (x + y * inventoryCols).ToString()); } // we dont have items to show else { GUI.Label(new Rect(20 + (x * buttonWidth), 65 + (y * buttonHeight), buttonWidth, buttonHeight), "none", "box"); } cnt++; } } } // if we want to show the armor that is not equipped if (bShowArmor) { for (int y = 0; y < inventoryRows; y++) { for (int x = 0; x < inventoryCols; x++) { // if we have items to show if (cnt < armor.Count) { if (GUI.Button(new Rect(20 + (x * buttonWidth), 65 + (y * buttonHeight), buttonWidth, buttonHeight), (x + y * inventoryCols).ToString())) { clickedItem = armor[x + y * inventoryCols]; placeInList = x + y * inventoryCols; displayDelete = false; //print ( placeInList ); } } // we dont have items to show else { GUI.Label(new Rect(20 + (x * buttonWidth), 65 + (y * buttonHeight), buttonWidth, buttonHeight), "none", "box"); } cnt++; } } } // if we want to show the weapons that are not equipped if (bShowWeapons) { for (int y = 0; y < inventoryRows; y++) { for (int x = 0; x < inventoryCols; x++) { // if we have items to show if (cnt < weapons.Count) { if (GUI.Button(new Rect(20 + (x * buttonWidth), 65 + (y * buttonHeight), buttonWidth, buttonHeight), (x + y * inventoryCols).ToString())) { clickedItem = weapons[x + y * inventoryCols]; placeInList = x + y * inventoryCols; displayDelete = false; } } // we dont have items to show else { GUI.Label(new Rect(20 + (x * buttonWidth), 65 + (y * buttonHeight), buttonWidth, buttonHeight), "none", "box"); } cnt++; } } } }