// Update is called once per frame void Update() { if (currentMana >= minMana) { magicUsable = true; } else { magicUsable = false; } if (timeBtwShots <= 0 & magicUsable == true) { if (Input.GetButtonDown("Magic")) { Instantiate(projectile, shotPoint.position, transform.rotation); AkSoundEngine.PostEvent("Magic_Attack_Event", gameObject); timeBtwShots = startTimeBtwShots; currentMana -= manaUsage; manaUI.SetMana(currentMana); } } else { timeBtwShots -= Time.deltaTime; } }
public virtual void Update() { if (knockbackCount <= 0) { } else { if (knockFromRight) { rigi.velocity = new Vector2(-knockback * 4, knockback); } if (!knockFromRight) { rigi.velocity = new Vector2(knockback * 4, knockback); } knockbackCount -= Time.deltaTime; } minMana = manaUsage.GetValue(); if (currentMana >= minMana) { magicUsable = true; } else { magicUsable = false; } if (timeBtwShots <= 0 & magicUsable == true) { if (Input.GetButtonDown("Magic")) { Instantiate(projectile, shotPoint.position, playerSprite.rotation); timeBtwShots = startTimeBtwShots; currentMana -= manaUsage.GetValue(); manaUI.SetMana(currentMana); } } else { timeBtwShots -= Time.deltaTime; } }