public void OpenRankupUI(CWIS_Turret whichTurret)
 {
     cwis1Turret.enabled = false;
     cwis2Turret.enabled = false;
     rankui.GetComponentsInChildren <Text>()[0].text    = "Upgrading: " + whichTurret.gameObject.name;
     rankui.gameObject.GetComponent <RankupUI>().turret = whichTurret;
     rankui.gameObject.GetComponent <RankupUI>().rate   = whichTurret.rateOfFire;
     rankui.gameObject.GetComponent <RankupUI>().ammo   = whichTurret.ammoCap;
     rankui.gameObject.GetComponent <RankupUI>().cool   = whichTurret.coolerEff;
     rankui.gameObject.GetComponent <RankupUI>().Setup();
     titleTxt.text = "...";
     descTxt.text  = "Select an option to see what it does.";
     openRankupUI  = true;
 }
        private void CheckCWForRankup(CWIS_Turret turret, int hits, int bestRank)
        {
            if (hits >= rankUpRequirements[0])
            {
                turret.thisRank = Rankup(Ranks.None);

                switch (bestRank)
                {
                case 1:
                    if (cw1BestRank == 0)
                    {
                        cw1BestRank++;
                        buttons[0].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                case 2:
                    if (cw2BestRank == 0)
                    {
                        cw2BestRank++;
                        buttons[1].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                default:
                    break;
                }
            }

            if (hits >= rankUpRequirements[1])
            {
                turret.thisRank = Rankup(Ranks.Chev1);

                switch (bestRank)
                {
                case 1:
                    if (cw1BestRank == 1)
                    {
                        cw1BestRank++;
                        buttons[0].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                case 2:
                    if (cw2BestRank == 1)
                    {
                        cw2BestRank++;
                        buttons[1].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                default:
                    break;
                }
            }

            if (hits >= rankUpRequirements[2])
            {
                turret.thisRank = Rankup(Ranks.Chev2);

                switch (bestRank)
                {
                case 1:
                    if (cw1BestRank == 2)
                    {
                        cw1BestRank++;
                        buttons[0].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                case 2:
                    if (cw2BestRank == 2)
                    {
                        cw2BestRank++;
                        buttons[1].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                default:
                    break;
                }
            }

            if (hits >= rankUpRequirements[3])
            {
                turret.thisRank = Rankup(Ranks.Chev3);

                switch (bestRank)
                {
                case 1:
                    if (cw1BestRank == 3)
                    {
                        cw1BestRank++;
                        buttons[0].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                case 2:
                    if (cw2BestRank == 3)
                    {
                        cw2BestRank++;
                        buttons[1].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                default:
                    break;
                }
            }

            if (hits >= rankUpRequirements[4])
            {
                turret.thisRank = Rankup(Ranks.Star1);

                switch (bestRank)
                {
                case 1:
                    if (cw1BestRank == 4)
                    {
                        cw1BestRank++;
                        buttons[0].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                case 2:
                    if (cw2BestRank == 4)
                    {
                        cw2BestRank++;
                        buttons[1].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                default:
                    break;
                }
            }

            if (hits >= rankUpRequirements[5])
            {
                turret.thisRank = Rankup(Ranks.Star2);

                switch (bestRank)
                {
                case 1:
                    if (cw1BestRank == 5)
                    {
                        cw1BestRank++;
                        buttons[0].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                case 2:
                    if (cw2BestRank == 5)
                    {
                        cw2BestRank++;
                        buttons[1].shouldFlicker = true;
                        am.Play("levelup", .35f, Random.Range(.85f, 1.15f));
                    }
                    break;

                default:
                    break;
                }
            }
        }