Пример #1
0
 void Update()
 {
     if (!started)
     {
         return;
     }
     if (Input.GetButtonDown("RedPuppet"))
     {
         if (ammo.CanFire(true))
         {
             ammo.Fire(true);
         }
         else
         {
             if (!RedReloading)
             {
                 RedReloading = true;
                 ammo.AddBullet(true);
             }
         }
     }
     if (Input.GetButtonUp("RedPuppet"))
     {
         if (!ammo.CanFire(true) && RedReloading)
         {
             RedReloading = false;
             ammo.RemoveBullet(true);
         }
     }
     if (Input.GetButtonDown("BluePuppet"))
     {
         if (ammo.CanFire(false))
         {
             ammo.Fire(false);
         }
         else
         {
             if (!BlueReloading)
             {
                 BlueReloading = true;
                 ammo.AddBullet(false);
             }
         }
     }
     if (Input.GetButtonUp("BluePuppet"))
     {
         if (!ammo.CanFire(false) && BlueReloading)
         {
             BlueReloading = false;
             ammo.RemoveBullet(false);
         }
     }
 }
    private void ReleaseReload(bool red, int index)
    {
        bool[] reloading = red ? ReloadingRed : ReloadingBlue;
        if (NeedsReload(red))
        {
            AudienceScript.Show(index, AudienceUIScript.Notice.Alert, red);
        }

        if (reloading[index])
        {
            reloading[index] = false;
            AmmoScript.RemoveBullet(red);
        }
    }