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

@ -9,7 +9,7 @@ public class FollowingPatrollingEnemy : Enemy
public Transform currentGoal;
public AStarPathfindingAgent agent;
public Transform target;
public float chaseRadius;
public float attackRadius;
@ -42,12 +42,14 @@ public class FollowingPatrollingEnemy : Enemy
public float expValue;
public float dmgValue;
void Awake()
{
//agent = GetComponent<AStarPathfindingAgent>();
}
// Start is called before the first frame update
void Start()
{
@ -104,7 +106,8 @@ public class FollowingPatrollingEnemy : Enemy
{
if (timerHit >= hitWaitTime)
{
TakeDamage(1.0f);
dmgValue = PlayerPrefs.GetFloat("attackValue");
TakeDamage(dmgValue);
hit = false;
timerHit = 0f;
TakeKnockback();
@ -123,7 +126,7 @@ public class FollowingPatrollingEnemy : Enemy
StopAllCoroutines();
if (Vector2.Distance(target.position, transform.position) <= chaseRadius && Vector2.Distance(target.position, transform.position) > attackRadius)
{
//Debug.Log(agent);
agent.FindPath();
//transform.position = Vector2.MoveTowards(transform.position, target.position, moveSpeed * Time.deltaTime);
@ -131,9 +134,9 @@ public class FollowingPatrollingEnemy : Enemy
}
else if (Vector2.Distance(target.position, transform.position) > chaseRadius)
{
//Debug.Log(Vector2.Distance(transform.position, path[currentPoint].position));
if (Vector2.Distance(transform.position, path[currentPoint].position) > roundingDistance)
{
StopAllCoroutines();
@ -161,7 +164,7 @@ public class FollowingPatrollingEnemy : Enemy
firstAttack = false;
}
if (collision.tag == "AttackHitbox" || collision.tag == "PickaxeHitbox")
if (collision.tag == "AttackHitbox" || collision.tag == "PickaxeHitbox")
{
hit = true;
}

View File

@ -49,6 +49,8 @@ public class Player : MonoBehaviour
public LevelBar levelBar;
public FloatValue minPlayerExp;
public float attackValue;
public static void putPlayerInCollider()
{
playerInCollider = true;
@ -218,6 +220,7 @@ public class Player : MonoBehaviour
void Update()
{
if (lvlUp == true)
{
PlayerPrefs.SetInt("LvlUpPopUp", 1);
@ -353,7 +356,40 @@ public class Player : MonoBehaviour
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");
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()