Added functional strength points

This commit is contained in:
Alicja 2022-11-15 12:32:28 +01:00
parent fbe444689f
commit cf353876ea
2 changed files with 46 additions and 7 deletions

View File

@ -42,6 +42,8 @@ public class FollowingPatrollingEnemy : Enemy
public float expValue; public float expValue;
public float dmgValue;
void Awake() void Awake()
{ {
@ -104,7 +106,8 @@ public class FollowingPatrollingEnemy : Enemy
{ {
if (timerHit >= hitWaitTime) if (timerHit >= hitWaitTime)
{ {
TakeDamage(1.0f); dmgValue = PlayerPrefs.GetFloat("attackValue");
TakeDamage(dmgValue);
hit = false; hit = false;
timerHit = 0f; timerHit = 0f;
TakeKnockback(); TakeKnockback();

View File

@ -49,6 +49,8 @@ public class Player : MonoBehaviour
public LevelBar levelBar; public LevelBar levelBar;
public FloatValue minPlayerExp; public FloatValue minPlayerExp;
public float attackValue;
public static void putPlayerInCollider() public static void putPlayerInCollider()
{ {
playerInCollider = true; playerInCollider = true;
@ -218,6 +220,7 @@ public class Player : MonoBehaviour
void Update() void Update()
{ {
if (lvlUp == true) if (lvlUp == true)
{ {
PlayerPrefs.SetInt("LvlUpPopUp", 1); PlayerPrefs.SetInt("LvlUpPopUp", 1);
@ -353,7 +356,40 @@ public class Player : MonoBehaviour
public void ManageStrength() public void ManageStrength()
{ {
if (!EquipmentManager.Instance._weapon)
{
attackValue = 0f;
}
else if (EquipmentManager.Instance._weapon.Name.Equals("pickaxe_test"))
{
attackValue = 0.5f;
PlayerPrefs.SetFloat("attackValue", attackValue);
}
else if (EquipmentManager.Instance._weapon.Name.Equals("Basic_Sword"))
{
attackValue = 1.0f;
PlayerPrefs.SetFloat("attackValue", attackValue);
}
strengthPoints = PlayerPrefs.GetInt("strengthPoints"); strengthPoints = PlayerPrefs.GetInt("strengthPoints");
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()