Example #1
0
 void Update()
 {
     if (Input.GetButtonDown(playerShootName) && !shooting && shootTimer <= 0)
     {
         if (playerMana.canShoot(manaCost))
         {
             playerMana.decreaseMana(manaCost);
             shooting   = true;
             shootTimer = shootCooldown;
             animator.SetTrigger("shoot");
         }
     }
     if (shootTimer > 0)
     {
         shootTimer -= Time.deltaTime;
     }
     if (shooting)
     {
         if (shootTimer < shootTriggerTimer)
         {
             Shoot();
             shooting = false;
         }
     }
     animator.SetBool("shooting", shooting);
 }