Exemple #1
0
    private IEnumerator WaitThenFire(float duration)
    {
        yield return(new WaitForSeconds(duration));

        ForEachParticleDo((ParticleSystem p) => { p.Stop(); });
        windupSound.Stop();
        nextFireMode.Fire();
        weapon.StartCooldown();
        windup = null;
    }
 public override void Hold()
 {
     if (chargeStarted)
     {
         if (currentCharge <= maxHoldTime)
         {
             currentCharge += Time.deltaTime;
         }
         else
         {
             ForEachParticleDo((ParticleSystem p) => { p.Stop(); });
             nextFireMode.Fire();
             chargeStarted = false;
             weapon.StartCooldown();
             currentCharge = 0f;
         }
     }
     else
     {
         Fire();
     }
 }
    private IEnumerator Burst(int numShots, float duration)
    {
        float delay = duration / (float)numShots;

        for (int i = 0; i < numShots; i++)
        {
            if (nextFireMode)
            {
                nextFireMode.Fire();
            }
            yield return(new WaitForSeconds(delay));
        }
        firing = null;
    }