public void TakeDamage(int amount) { DPS_FloatingTextController.CreateFloatingText(amount.ToString(), transform); currentHealth -= amount; if (currentHealth <= 0) { Die(); } }
void Start() { DPS_FloatingTextController.Initialize(); DropTable = new DropTable(); /* Example below, summing up the 25% chance of drops, we have a total of 75%. * This means that 25% of the time, the NPC may drop nothing. */ DropTable.loot = new List <LootDrop> { new LootDrop("Sword", 25), new LootDrop("Staff_Of_Pain", 25), new LootDrop("Heal_Potion", 25) }; ID = 0; /* Skelly is the first enemy, and its = 0. */ Experience = 200; navAgent = GetComponent <NavMeshAgent>(); /* Reference from navagent on the enemy */ characterStats = new CharacterStats(5, 10, 15); currentHealth = maxHealth; }