Hey so I am an amateur coder in c# and I cannot seem to figure out how to answer this question.
Here is the script I am working on so far.
using UnityEngine;
using System.Collections;
public class Attack : MonoBehaviour
{
public bool IsDead;
public bool AddEXP;
public bool CanUpgrade;
public bool EnemyIsDead;
public int EnemyHealth;
public int MyHealth;
public int Damage;
public int EnemyDamage;
public int exp;
public int expToUpgrade;
public int enemyToughness;
public GameObject Enemy; // I want the player to be able to set this gameobject with the click of a mouse. HOW?
public GameObject Me;
void Start()
{
IsDead = false;
EnemyHealth = 10;
MyHealth = 20;
Damage = 1;
EnemyDamage = 1;
}
void Update()
{
if (MyHealth <= 0) {
IsDead = true;
} else if (MyHealth >= 1)
{
IsDead = false;
}
if (EnemyHealth >= 1) {
EnemyIsDead = false;
} else if (EnemyHealth <= 0)
{
EnemyIsDead = true;
}
if (EnemyIsDead == true)
{
Destroy (Enemy.gameObject);
}
if(IsDead == true)
{
Destroy (Me.gameObject);
}
if (exp >= expToUpgrade)
{
exp -= expToUpgrade;
Damage += 5;
enemyToughness += 1;
}
EnemyDamage = enemyToughness * 5;
EnemyHealth = enemyToughness * 10; //Will change if gets out of hand
if(EnemyIsDead == true && AddEXP == true)
{
exp += enemyToughness * 5;
AddEXP = false;
}
}