Hello! I have 2 Scripts. One for the “Stats” and one for “The Enemy”. I want so when an Enemy Dies
It Gives XP to the Player. How can i do that? Any Ideas?
SCRIPT:
using UnityEngine;
using System.Collections;
public class EnemyHealth : MonoBehaviour {
public int maxHealth;
public int curHealth;
public int GiveXP;
public GameObject destroy;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
AddjustCurrentHealth(0);
}
public void AddjustCurrentHealth(int adj) {
curHealth += adj;
if(curHealth <= 0)
Die();
if(curHealth > maxHealth)
curHealth = maxHealth;
if(maxHealth < 1)
maxHealth = 1;
}
public void Die () {
curHealth = 0;
Destroy(destroy);
}
}