void Update()
{
// Regenerate the energy/mana bar after a specified amount of time
if (Time.time > nextTime)
{
nextTime = Time.time + 1f;
if (cooldown != 100f)
{
cooldown += regen;
}
UpdateCoolDownSlider();
}
// Perform a basic melee attack
if (Input.GetKeyDown(KeyCode.J) && Time.time > nextMelee)
{
// Playsound, animate and attack
PlayerSfxScript.playMeleeSound();
anim.SetTrigger("Melee");
// Pauses to sync up more with the animation
Invoke("AttactInstantiate", 0.15f);
nextMelee = Time.time + meleeRate;
}
}