Update Kills count & Passive heal

This commit is contained in:
2023-10-17 13:48:58 +02:00
parent 797a399977
commit d6f946acf1
2 changed files with 29 additions and 3 deletions
+12 -1
View File
@@ -28,7 +28,18 @@ public class Ennemy : MonoBehaviour
if (Life <= 0)
{
Destroy(gameObject);
_player.GetComponent<PlayerManager>().MayorKills++;
if (gameObject.name.Contains("Mayor"))
{
_player.GetComponent<PlayerManager>().MayorKills++;
}
else if (gameObject.name.Contains("Minotaur"))
{
_player.GetComponent<PlayerManager>().MinautorKills++;
}
else if(gameObject.name.Contains("Bringer of Death"))
{
_player.GetComponent<PlayerManager>().BringerOfDeathKills++;
}
}
}
+17 -2
View File
@@ -2,14 +2,23 @@ using UnityEngine;
public class PlayerManager : MonoBehaviour
{
// Character stats
public int Health = 100;
public int MaxHealth = 100;
public int HealValue = 1;
public float Speed = 2f;
public int Exp = 0;
public int Level = 1;
// Weapons stats
public int BeamDamages = 50;
public int SwordsDamages = 25;
public int ArrowDamages = 15;
// Kills stats
public int MayorKills = 0;
public int MinautorKills = 0;
public int BringerOfDeathKills = 0;
[SerializeField]
private GameObject pauseMenu;
@@ -17,6 +26,11 @@ public class PlayerManager : MonoBehaviour
[SerializeField]
private GameObject deathScreen;
private void Start()
{
InvokeRepeating(nameof(Heal), 1f, 1f);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
@@ -37,6 +51,7 @@ public class PlayerManager : MonoBehaviour
}
}
// --- CHARACTER STATS ---------------------------------------------------------------------
public void TakeDamage(int value)
{
Health -= value;
@@ -53,9 +68,9 @@ public class PlayerManager : MonoBehaviour
}
}
public void Heal(int value)
public void Heal()
{
Health += value;
Health += HealValue;
if (Health > MaxHealth)
{
Health = MaxHealth;