Fix attack & defense & health calculation

This commit is contained in:
kabix09 2022-12-29 00:58:03 +01:00
parent 7db7398c75
commit 84fe5a450f
18 changed files with 468 additions and 81 deletions

View File

@ -130,7 +130,7 @@ public class FollowingEnemy : Enemy
{ {
if(timerHit >= hitWaitTime) if(timerHit >= hitWaitTime)
{ {
TakeDamage(1.0f); TakeDamage(PlayerPrefs.GetFloat("attackValue"));
hit = false; hit = false;
timerHit = 0f; timerHit = 0f;
TakeKnockback(); TakeKnockback();

View File

@ -104,7 +104,7 @@ public class FollowingPatrollingEnemy : Enemy
{ {
if (timerHit >= hitWaitTime) if (timerHit >= hitWaitTime)
{ {
TakeDamage(1.0f); TakeDamage(PlayerPrefs.GetFloat("attackValue"));
hit = false; hit = false;
timerHit = 0f; timerHit = 0f;
TakeKnockback(); TakeKnockback();

View File

@ -35,21 +35,32 @@ public class Player : MonoBehaviour
private bool canWalk = true; private bool canWalk = true;
public float currentHealth; [Header("Player Starts values")]
public float maxHealth; public const int BaseHealth = 10;
public const float BaseSpeed = 4f;
[Header("Player Skills Points")]
public int healthPoints; public int healthPoints;
public int defensePoints; public int defensePoints;
public int strengthPoints; public int strengthPoints;
public int intelligencePoints; public int intelligencePoints;
[Header("Player current values")]
public float attackValue;
public float defenseValue;
public float currentSpeed; // as WalkSpeed
public float currentHealth;
public float maxHealth;
public float exp; public float exp;
public int lvl; public int lvl;
public float maxExp; public float maxExp;
public LevelBar levelBar; public LevelBar levelBar;
public FloatValue minPlayerExp; public FloatValue minPlayerExp;
public float attackValue;
public static void putPlayerInCollider() public static void putPlayerInCollider()
{ {
@ -84,7 +95,11 @@ public class Player : MonoBehaviour
//healthBar.SetHealth(currentHealth); //healthBar.SetHealth(currentHealth);
//levelBar.SetStartExp(minPlayerExp.initialValue); //levelBar.SetStartExp(minPlayerExp.initialValue);
//levelBar.SetExp(exp); //levelBar.SetExp(exp);
walkSpeed = 4f;
ManageSpeed();
walkSpeed = PlayerPrefs.GetFloat("speed");
ManageLevels(exp); ManageLevels(exp);
} }
@ -144,18 +159,12 @@ public class Player : MonoBehaviour
{ {
defensePoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_DEFENSE_POINTS); defensePoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_DEFENSE_POINTS);
if(defensePoints == 1)
{ Debug.Log($"Minion Damage: {damage}; \nDefense: {PlayerPrefs.GetFloat("defenseValue")}");
damage = damage * 0.95f;
} damage = damage - PlayerPrefs.GetFloat("defenseValue");
else if(defensePoints == 2)
{ Debug.Log($"RealDamage: {damage}");
damage = damage * 0.9f;
}
else if(defensePoints == 3)
{
damage = damage * 0.85f;
}
currentHealth = PlayerPrefs.GetFloat("health"); currentHealth = PlayerPrefs.GetFloat("health");
currentHealth = currentHealth - damage; currentHealth = currentHealth - damage;
@ -189,21 +198,30 @@ public class Player : MonoBehaviour
if (canWalk == true) if (canWalk == true)
{ {
if (EquipmentUIManager.Instance.GetList().Count() == 0 || EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() == 0) /* if (EquipmentUIManager.Instance.GetList().Count() == 0 || EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() == 0)
return; return;*/
if (EquipmentUIManager.Instance.GetList().Count() != 0 && EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.Name.Equals("Pickaxe") && attackSword) if (attackFist)
{
myAnimator.SetTrigger("attackFist");
} else if (attackSword &&
EquipmentUIManager.Instance.GetList().Count() != 0 &&
EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.Name.Equals("Pickaxe"))
{ {
myAnimator.SetTrigger("pickaxe"); myAnimator.SetTrigger("pickaxe");
} }
else if (attackSword && EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.EquipmentType == EquipmentTypeEnum.Weapon) else if (attackSword &&
EquipmentUIManager.Instance.GetList().Count() != 0 &&
EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.EquipmentType == EquipmentTypeEnum.Weapon)
{ {
myAnimator.SetTrigger("attack"); myAnimator.SetTrigger("attack");
} }
else if (attackFist)
{
myAnimator.SetTrigger("attackFist");
}
} }
} }
@ -245,6 +263,7 @@ public class Player : MonoBehaviour
ManageDefense(); ManageDefense();
ManageIntelligence(); ManageIntelligence();
ManageStrength(); ManageStrength();
ManageSpeed();
if (canWalk == true) if (canWalk == true)
{ {
@ -252,8 +271,12 @@ public class Player : MonoBehaviour
inputHorizontal = Input.GetAxisRaw("Horizontal"); inputHorizontal = Input.GetAxisRaw("Horizontal");
inputVertical = Input.GetAxisRaw("Vertical"); inputVertical = Input.GetAxisRaw("Vertical");
// speed calculated in ManageSpeed function
walkSpeed = PlayerPrefs.GetFloat("speed");
myAnimator.SetFloat("moveX", inputHorizontal * walkSpeed); myAnimator.SetFloat("moveX", inputHorizontal * walkSpeed);
myAnimator.SetFloat("moveY", inputVertical * walkSpeed); myAnimator.SetFloat("moveY", inputVertical * walkSpeed);
if (inputHorizontal != 0) if (inputHorizontal != 0)
{ {
myAnimator.SetFloat("speed", walkSpeed); myAnimator.SetFloat("speed", walkSpeed);
@ -341,23 +364,18 @@ public class Player : MonoBehaviour
public void ManageHealth() public void ManageHealth()
{ {
//nie wiem czy to potrzebne ale zostawiam tak
healthPoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_HEALTH_POINTS); healthPoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_HEALTH_POINTS);
if (healthPoints == 0)
{
PlayerPrefs.SetFloat("maxHealth", 10); // nowe - analogicznie jak w ataku
} var healthCalculltor = new HealthCalcullator();
else if (healthPoints == 1)
{ var health = BaseHealth + healthCalculltor.CalculateWithoutItem();
PlayerPrefs.SetFloat("maxHealth", 12);
} PlayerPrefs.SetFloat("maxHealth", health);
else if (healthPoints == 2)
{ Debug.Log("Health: " + PlayerPrefs.GetFloat("maxHealth"));
PlayerPrefs.SetFloat("maxHealth", 14);
}
else if (healthPoints == 3)
{
PlayerPrefs.SetFloat("maxHealth", 16);
}
} }
public void AddHealthPoint() public void AddHealthPoint()
@ -374,42 +392,29 @@ public class Player : MonoBehaviour
{ {
if (EquipmentUIManager.Instance.GetList().Count() == 0 || EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() == 0) if (EquipmentUIManager.Instance.GetList().Count() == 0 || EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() == 0)
{ {
attackValue = 0f; var attackCalculator = new AttackCalcullator();
}
else if (EquipmentUIManager.Instance.GetList().Count() != 0 && attackValue = attackCalculator.CalculateWithoutItem();
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.Name.Equals("Pickaxe"))
{
attackValue = 0.5f;
PlayerPrefs.SetFloat("attackValue", attackValue); PlayerPrefs.SetFloat("attackValue", attackValue);
} }
else if (EquipmentUIManager.Instance.GetList().Count() != 0 && else if (EquipmentUIManager.Instance.GetList().Count() != 0 &&
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() > 0 && EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.Name.Equals("Basic Sword")) EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value.EquipmentType == EquipmentTypeEnum.Weapon)
{ {
attackValue = 1.0f; var equippedItem = EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.WeaponSlot && el.Value != null).First().Value;
var attackCalculator = new AttackCalcullator();
attackValue = attackCalculator.Calculate(equippedItem.Value);
PlayerPrefs.SetFloat("attackValue", attackValue); PlayerPrefs.SetFloat("attackValue", attackValue);
} else
{
throw new System.Exception("Attack Calculation Error");
} }
strengthPoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_STRENGHT_POINTS); Debug.Log("Attack: " + PlayerPrefs.GetFloat("attackValue"));
if(strengthPoints == 1)
{
attackValue = PlayerPrefs.GetFloat("attackValue");
attackValue = attackValue * 1.1f;
PlayerPrefs.SetFloat("attackValue", attackValue);
}
else if(strengthPoints == 2)
{
attackValue = PlayerPrefs.GetFloat("attackValue");
attackValue = attackValue * 1.2f;
PlayerPrefs.SetFloat("attackValue", attackValue);
}
else if(strengthPoints == 3)
{
attackValue = PlayerPrefs.GetFloat("attackValue");
attackValue = attackValue * 1.3f;
PlayerPrefs.SetFloat("attackValue", attackValue);
}
} }
public void AddStrengthPoint() public void AddStrengthPoint()
@ -424,7 +429,51 @@ public class Player : MonoBehaviour
public void ManageDefense() public void ManageDefense()
{ {
//nie wiem czy to potrzebne ale zostawiam tak
defensePoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_DEFENSE_POINTS); defensePoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_DEFENSE_POINTS);
// nowe - analogicznie jak w ataku
var defenseCalculator = new DefenseCalculattor();
if (EquipmentUIManager.Instance.GetList().Count() == 0 ||
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.HelmetSlot && el.Value != null).Count() == 0 &&
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.ArmorSlot && el.Value != null).Count() == 0
){
defenseValue = defenseCalculator.CalculateWithoutItem();
PlayerPrefs.SetFloat("defenseValue", defenseValue);
}
else if (EquipmentUIManager.Instance.GetList().Count() != 0 &&
(EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.HelmetSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.HelmetSlot && el.Value != null).First().Value.EquipmentType == EquipmentTypeEnum.Helmet) ||
(EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.ArmorSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList()
.Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.ArmorSlot && el.Value != null).First().Value.EquipmentType == EquipmentTypeEnum.Chest)
) {
var helmetSlot = EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.HelmetSlot && el.Value != null);
var helmet = (helmetSlot.Count() != 0) ? helmetSlot.First().Value.Value : 0;
var chestplateSlot = EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.ArmorSlot && el.Value != null);
var chestplate = (chestplateSlot.Count() != 0) ? chestplateSlot.First().Value.Value : 0;
defenseValue = defenseCalculator.Calculate(helmet + chestplate);
PlayerPrefs.SetFloat("defenseValue", defenseValue);
}
else
{
throw new System.Exception("Defense Calculation Error");
}
Debug.Log("Defense: " + PlayerPrefs.GetFloat("defenseValue"));
} }
public void AddDefensePoint() public void AddDefensePoint()
@ -457,5 +506,31 @@ public class Player : MonoBehaviour
healthPoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_HEALTH_POINTS); healthPoints = PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_HEALTH_POINTS);
} }
public void ManageSpeed()
{
var speed = 0f;
var speedCalculator = new SpeedCalcullator();
if (EquipmentUIManager.Instance.GetList().Count() == 0 || EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.BootsSlot && el.Value != null).Count() == 0)
{
speed = BaseSpeed + speedCalculator.CalculateWithoutItem();
}
else if (EquipmentUIManager.Instance.GetList().Count() != 0 &&
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.BootsSlot && el.Value != null).Count() > 0 &&
EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.BootsSlot && el.Value != null).First().Value.EquipmentType == EquipmentTypeEnum.Boots)
{
var boots = EquipmentUIManager.Instance.GetList().Where(el => el.Key == (int)EquipmentPanelSlotsTypeEnum.BootsSlot && el.Value != null).First().Value;
speed = BaseSpeed + speedCalculator.Calculate(boots.Value);
}
PlayerPrefs.SetFloat("speed", speed);
Debug.Log("Speed: " + PlayerPrefs.GetFloat("speed"));
}
// nowe - analogicznie jak w ataku
} }

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 041cc90253aadb149a2252682aa0ee1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
class AttackCalcullator : PlayerPramCalcullator
{
protected override List<EquipmentTypeEnum> EQUIPMENT_TYPE => new List<EquipmentTypeEnum>(){EquipmentTypeEnum.Weapon, EquipmentTypeEnum.Ring, EquipmentTypeEnum.Necklet, EquipmentTypeEnum.Boots};
protected override ItemBonusEnum BONUS_TYPE => ItemBonusEnum.Strenght;
protected override float Pattern(int itemValue, int SkillPoints, int BonusSum)
{
return (1 + (2*SkillPoints + BonusSum) / 10f) + itemValue;
}
protected override float WithoutItemPattern(int SkillPoints, int BonusSum)
{
return (0.7f + (SkillPoints + BonusSum) / 8f);
}
public override int GetSkillPoints()
{
return PlayerPrefs.HasKey(SkillsPointsManger.PLAYER_SKILS_STRENGHT_POINTS)
? PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_STRENGHT_POINTS)
: 0
;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0ff018e0aace844e8bfaae26443489d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
class DefenseCalculattor : PlayerPramCalcullator
{
protected override List<EquipmentTypeEnum> EQUIPMENT_TYPE => new List<EquipmentTypeEnum>() { EquipmentTypeEnum.Helmet, EquipmentTypeEnum.Chest, EquipmentTypeEnum.Ring, EquipmentTypeEnum.Necklet, EquipmentTypeEnum.Boots };
protected override ItemBonusEnum BONUS_TYPE => ItemBonusEnum.Enduration;
public override int GetSkillPoints()
{
return PlayerPrefs.HasKey(SkillsPointsManger.PLAYER_SKILS_DEFENSE_POINTS)
? PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_DEFENSE_POINTS)
: 0
;
}
protected override float Pattern(int itemValue, int SkillPoints, int BonusSum)
{
return (1 + (2*SkillPoints + BonusSum) / 10f) + itemValue;
}
protected override float WithoutItemPattern(int SkillPoints, int BonusSum)
{
return (SkillPoints + BonusSum) / 6f;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9d729aa51d142f641965f8b47e1e334a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
class HealthCalcullator : PlayerPramCalcullator
{
protected override List<EquipmentTypeEnum> EQUIPMENT_TYPE => new List<EquipmentTypeEnum>() {
EquipmentTypeEnum.Weapon,
EquipmentTypeEnum.Helmet,
EquipmentTypeEnum.Chest,
EquipmentTypeEnum.Ring,
EquipmentTypeEnum.Necklet,
EquipmentTypeEnum.Boots
};
protected override ItemBonusEnum BONUS_TYPE => ItemBonusEnum.Vitality;
public override int GetSkillPoints()
{
return PlayerPrefs.HasKey(SkillsPointsManger.PLAYER_SKILS_HEALTH_POINTS)
? PlayerPrefs.GetInt(SkillsPointsManger.PLAYER_SKILS_HEALTH_POINTS)
: 0
;
}
protected override float Pattern(int baseValue, int SkillPoints, int BonusSum)
{
throw new NotImplementedException("HealthCalcullator - Pattern - Not implemented");
return baseValue + WithoutItemPattern(SkillPoints, BonusSum);
}
protected override float WithoutItemPattern(int SkillPoints, int BonusSum)
{
return 2 * SkillPoints + BonusSum;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d184b461015cf345826716a7a2fef77
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// takie same jak w bonusach itemow
public enum ItemBonusEnum
{
None,
Strenght,
Enduration,
Vitality,
Inteligence,
Speed
}
public abstract class PlayerPramCalcullator
{
protected virtual List<EquipmentTypeEnum> EQUIPMENT_TYPE => new List<EquipmentTypeEnum>();
protected virtual ItemBonusEnum BONUS_TYPE => ItemBonusEnum.None;
public virtual float Calculate(int itemValue)
{
var skillPoints = GetSkillPoints();
var bonusSum = CalculateBonusByType();
return Pattern(itemValue, skillPoints, bonusSum);
}
public virtual float CalculateWithoutItem()
{
var skillPoints = GetSkillPoints();
var bonusSum = CalculateBonusByType();
return WithoutItemPattern(skillPoints, bonusSum);
}
protected abstract float Pattern(int itemValue, int SkillPoints, int BonusSum);
protected abstract float WithoutItemPattern(int SkillPoints, int BonusSum);
public abstract int GetSkillPoints();
public int CalculateBonusByType()
{
var bonusSum = 0;
if (EquipmentUIManager.Instance.GetList().Count() == 0)
return bonusSum;
// Every equipped item by player with mached type
foreach(var equipmentType in EQUIPMENT_TYPE)
{
var machedEquippedItems = EquipmentUIManager
.Instance
.GetList()
.Where(slot => (slot.Value != null && slot.Value.EquipmentType == equipmentType))
.Select(slot => slot.Value)
.ToList()
;
foreach(var equippedItem in machedEquippedItems)
{
bonusSum += GetBonusFromItem(equippedItem, BONUS_TYPE);
}
}
return bonusSum;
}
protected int GetBonusFromItem(EquippableItem item, ItemBonusEnum itemBonus)
{
switch(itemBonus)
{
case ItemBonusEnum.Strenght:
{
return item.StrengthBonus;
}
case ItemBonusEnum.Enduration:
{
return item.EnduranceBonus;
}
case ItemBonusEnum.Vitality:
{
return item.VitalityBonus;
}
case ItemBonusEnum.Inteligence:
{
return item.InteligenceBonus;
}
case ItemBonusEnum.Speed:
{
return item.SpeedBonus;
}
default:
{
return 0;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a40e38539ac24d45b160435e7641ad6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
class SpeedCalcullator : PlayerPramCalcullator
{
protected override List<EquipmentTypeEnum> EQUIPMENT_TYPE => new List<EquipmentTypeEnum>() {
EquipmentTypeEnum.Weapon,
EquipmentTypeEnum.Ring,
EquipmentTypeEnum.Necklet,
EquipmentTypeEnum.Boots
};
protected override ItemBonusEnum BONUS_TYPE => ItemBonusEnum.Speed;
public override int GetSkillPoints()
{
return 0;
}
protected override float Pattern(int itemValue, int SkillPoints, int BonusSum)
{
return WithoutItemPattern(SkillPoints, BonusSum) + itemValue * 0.1f;
}
protected override float WithoutItemPattern(int SkillPoints, int BonusSum)
{
return BonusSum * 0.05f;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aed30e6e0776bb140b87e4734498ace2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -96,8 +96,6 @@ class SkillsPointsManger : MonoBehaviour
if (SkillsUIManager.Instance.GetPanelStatus()) if (SkillsUIManager.Instance.GetPanelStatus())
{ {
Debug.Log("UpdatePanelView");
//SkillsUIManager //SkillsUIManager
SkillsUIManager.Instance.DynamicPanel.GetComponent<SkillsPanelController>().RefreshPanelView( SkillsUIManager.Instance.DynamicPanel.GetComponent<SkillsPanelController>().RefreshPanelView(
FreePoints, FreePoints,

View File

@ -6,10 +6,11 @@ using UnityEngine;
[CreateAssetMenu(fileName = "New Item", menuName = "Inventory/EquippableItem")] [CreateAssetMenu(fileName = "New Item", menuName = "Inventory/EquippableItem")]
public class EquippableItem : Item public class EquippableItem : Item
{ {
public int StrengthBonus = 0; public int StrengthBonus = 0; // attack
public int AgilityBonus = 0; public int EnduranceBonus = 0; // defence
public int VitalityBonus = 0; // health
public int InteligenceBonus = 0; public int InteligenceBonus = 0;
public int VitalityBonus = 0; public int SpeedBonus = 0;
[Space] [Space]
public bool isStackable = false; public bool isStackable = false;
@ -24,11 +25,13 @@ public class EquippableItem : Item
public EquippableItem(EquippableItem _item) : base(_item.name, _item.description, _item.level, _item.value, _item.price, _item.itemModel, _item.image) public EquippableItem(EquippableItem _item) : base(_item.name, _item.description, _item.level, _item.value, _item.price, _item.itemModel, _item.image)
{ {
StrengthBonus = _item.StrengthBonus; StrengthBonus = _item.StrengthBonus;
AgilityBonus = _item.AgilityBonus; EnduranceBonus = _item.EnduranceBonus;
InteligenceBonus = _item.InteligenceBonus;
VitalityBonus = _item.VitalityBonus; VitalityBonus = _item.VitalityBonus;
InteligenceBonus = _item.InteligenceBonus;
EquipmentType = _item.EquipmentType; EquipmentType = _item.EquipmentType;
SpeedBonus = _item.SpeedBonus;
} }
public EquippableItem(string _name, string _description, int _level, int _value, int _price, GameObject _itemModel, Sprite _image) : base(_name, _description, _level, _value, _price, _itemModel, _image) { } public EquippableItem(string _name, string _description, int _level, int _value, int _price, GameObject _itemModel, Sprite _image) : base(_name, _description, _level, _value, _price, _itemModel, _image) { }

View File

@ -8,7 +8,7 @@ public class EquippableItemData : ItemData
public int strengthBonus; public int strengthBonus;
[SerializeField] [SerializeField]
public int agilityBonus; public int enduranceBonus;
[SerializeField] [SerializeField]
public int inteligenceBonus; public int inteligenceBonus;
@ -16,6 +16,9 @@ public class EquippableItemData : ItemData
[SerializeField] [SerializeField]
public int vitalityBonus; public int vitalityBonus;
[SerializeField]
public int speedBonus;
[SerializeField] [SerializeField]
public bool isStackable; public bool isStackable;
@ -25,9 +28,10 @@ public class EquippableItemData : ItemData
public EquippableItemData(EquippableItem equippableItem) : base(equippableItem) public EquippableItemData(EquippableItem equippableItem) : base(equippableItem)
{ {
strengthBonus = equippableItem.StrengthBonus; strengthBonus = equippableItem.StrengthBonus;
agilityBonus = equippableItem.AgilityBonus; enduranceBonus = equippableItem.EnduranceBonus;
inteligenceBonus = equippableItem.InteligenceBonus; inteligenceBonus = equippableItem.InteligenceBonus;
vitalityBonus = equippableItem.VitalityBonus; vitalityBonus = equippableItem.VitalityBonus;
speedBonus = equippableItem.SpeedBonus;
isStackable = equippableItem.isStackable; isStackable = equippableItem.isStackable;
equipmentType = equippableItem.EquipmentType; equipmentType = equippableItem.EquipmentType;
@ -36,9 +40,10 @@ public class EquippableItemData : ItemData
public EquippableItemData(Item item) : base(item) public EquippableItemData(Item item) : base(item)
{ {
strengthBonus = 0; strengthBonus = 0;
agilityBonus = 0; enduranceBonus = 0;
inteligenceBonus = 0; inteligenceBonus = 0;
vitalityBonus = 0; vitalityBonus = 0;
speedBonus = 0;
isStackable = true; isStackable = true;
equipmentType = EquipmentTypeEnum.Other; equipmentType = EquipmentTypeEnum.Other;

View File

@ -43,7 +43,7 @@ public abstract class ItemData : ModelData<Item, Item>
/// ///
// equippableItem.StrengthBonus = strengthBonus; // equippableItem.StrengthBonus = strengthBonus;
// equippableItem.AgilityBonus = agilityBonus; // equippableItem.EnduranceBonus = enduranceBonus;
// equippableItem.InteligenceBonus = inteligenceBonus; // equippableItem.InteligenceBonus = inteligenceBonus;
// equippableItem.VitalityBonus = vitalityBonus; // equippableItem.VitalityBonus = vitalityBonus;
// equippableItem.isStackable = isStackable; // equippableItem.isStackable = isStackable;