Пример #1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (findTurret == true)
     {
         if (turrets[turretIterator].GetComponent <TurretScript>().getActive() == false)
         {
             activateTurret(turretIterator);
             findTurret = false;
         }
         turretIterator++;
         if (turretIterator >= numberOfTurrets)
         {
             turretIterator = 0;
         }
     }
     else
     {
         frames++;
         if (frames >= cooldownFrames) /*&& turrets[turretIterator].GetComponent<TurretScript>().getActiveNum() < maxTurrets)*/
         {
             if (turretIterator >= numberOfTurrets)
             {
                 turretIterator = 0;
             }
             if (turrets[turretIterator].GetComponent <TurretScript>().getActive() == false)
             {
                 activateTurret(turretIterator);
                 turretIterator++;
             }
             else
             {
                 findTurret = true;
             }
             frames = 0;
             if (cooldownFrames > /*10*/ activationCooldown)
             {
                 cooldownFrames -= activationCooldown /*10*/;
                 for (int i = 0; i < numberOfTurrets; i++)
                 {
                     GameObject   o = turrets[i];
                     TurretScript t = o.GetComponent <TurretScript>();
                     t.SetLazerCooldown(t.GetLazerCooldown() - /*0.1f*/ decreaseLazerCooldown);
                     t.SetLazerSpeed(t.GetLazerSpeed() + /*.1f*/ increaseLazerSpeed);
                 }
             }
         }
     }
 }