示例#1
0
 void drawRP()
 {
     playerScript.DrawQuad(new Rect(70, 52, 90, 0), Color.black);
     GUI.Label(new Rect(72, 42, 90, 20), new GUIContent("" + rpControllerScript.getCurrentRP(), "Research Points (RP)- gathered every minute, to spend visit the store")); //Draw Scraps Number
     GUI.DrawTexture(new Rect(147, 46, 12, 12), rpIcon, ScaleMode.StretchToFill);                                                                                          //Draw Scraps Icon
     GUI.skin.box.normal.background = null;                                                                                                                                //Resets it to Null so it doesn't affect other GUI's such as Store
 }
    public void displaySurvivorButtons()
    {
        //Survivors Secion Start
        if (playerScript.getCurrentScraps() > 499)
        {
            if (GUI.Button(new Rect(x, y, 190, 20), new GUIContent("Upgrade Bunker: 500 Scraps", "Adds more space to bunker for more survivors")))               //Display bunker Button
            {
                bunkerLevel += 1;
                playerScript.subtractScraps(500);
                soundControllerScript.playSFX("buy");
            }
        }
        else
        {
            GUI.enabled = false;
            if (GUI.Button(new Rect(x, y, 190, 20), "Not Enough Scraps (500)"))
            {
            }                                                                                  //Display bunker Button}
        }
        GUI.enabled = true;
        if (rpControllerScript.getCurrentRP() > 649)
        {
            if (GUI.Button(new Rect(x + 220, y, 190, 20), "Upgrade Bunker: 650 RP"))              //Display bunker Button
            {
                bunkerLevel += 3;
                //currentRP -= 650;
                storeControllerScript.subtractCurrentRP(650);
                storeControllerScript.updateRPPref();
                bunkerLevelCounter  = PlayerPrefs.GetInt("PurchasedbunkerLevels");
                bunkerLevelCounter += 2;
                PlayerPrefs.SetInt("PurchasedbunkerLevels", bunkerLevelCounter);
                soundControllerScript.playSFX("buy");
            }
        }
        else
        {
            GUI.enabled = false;
            if (GUI.Button(new Rect(x + 220, y, 190, 20), "Not Enough RP (650)"))
            {
            }                                                                                  //Display bunker Button}
        }

        maxSurvivors = bunkerLevel * 2;

        GUI.enabled = false;

        if (GUI.Button(new Rect(x + 35, y + 25, 170, 20), foundSurvivors + "/" + maxSurvivors + " survivors housed"))
        {
        }                                                                                                                    //Display Current Survivors / Max
        if (GUI.Button(new Rect(x + 215, y + 25, 170, 20), unallocatedSurvivors + "/" + foundSurvivors + " survivors un-allocated"))
        {
        }                                                                                                                                   //Display Current Survivors / Max

        GUI.enabled = false;
        if (GUI.Button(new Rect(x - 5, y + 50, 140, 20), new GUIContent(engineerSurvivors + " Engineers", "Engineers unlock equipment")))
        {
        }
        if (GUI.Button(new Rect(x + 140, y + 50, 140, 20), new GUIContent(scrapSurvivors + " Scrappers", "Scrappers give scrap after every round")))
        {
        }
        if (GUI.Button(new Rect(x + 285, y + 50, 140, 20), new GUIContent(ammoSurvivors + " Hoarders", "Hoarders give ammo after every round")))
        {
        }

        GUI.enabled = true;

        if (unallocatedSurvivors > 0)
        {
            if (GUI.Button(new Rect(x - 5, y + 75, 140, 20), "Allocate Engineers"))
            {
                engineerSurvivors++;
                unallocatedSurvivors--;
                soundControllerScript.playSFX("buy");
            }
            if (GUI.Button(new Rect(x + 140, y + 75, 140, 20), "Allocate Scrapper"))
            {
                scrapSurvivors++;
                unallocatedSurvivors--;
                soundControllerScript.playSFX("buy");
            }
            if (GUI.Button(new Rect(x + 285, y + 75, 140, 20), "Allocate Hoarders"))
            {
                ammoSurvivors++;
                unallocatedSurvivors--;
                soundControllerScript.playSFX("buy");
            }
            GUI.enabled = true;
        }
        else
        {
            GUI.enabled = false;
            if (GUI.Button(new Rect(x - 5, y + 75, 140, 20), "No Survivors"))
            {
            }
            if (GUI.Button(new Rect(x + 140, y + 75, 140, 20), "No Survivors"))
            {
            }
            if (GUI.Button(new Rect(x + 285, y + 75, 140, 20), "No Survivors"))
            {
            }
        }


        GUI.enabled = true;

        if (engineerSurvivors > 0)
        {
            if (GUI.Button(new Rect(x - 5, y + 100, 140, 20), "Un-Allocate Engineers"))
            {
                engineerSurvivors--;
                unallocatedSurvivors++;
                soundControllerScript.playSFX("buy");
            }
        }
        else
        {
            GUI.enabled = false;
            if (GUI.Button(new Rect(x - 5, y + 100, 140, 20), "No Engineers"))
            {
            }
        }

        GUI.enabled = true;

        if (scrapSurvivors > 0)
        {
            if (GUI.Button(new Rect(x + 140, y + 100, 140, 20), "Un-Allocate Scrappers"))
            {
                scrapSurvivors--;
                unallocatedSurvivors++;
                soundControllerScript.playSFX("buy");
            }
        }
        else
        {
            GUI.enabled = false;
            if (GUI.Button(new Rect(x + 140, y + 100, 140, 20), "No Scrappers"))
            {
            }
        }

        GUI.enabled = true;

        if (ammoSurvivors > 0)
        {
            if (GUI.Button(new Rect(x + 285, y + 100, 140, 20), "Un-Allocate Hoarders"))
            {
                ammoSurvivors--;
                unallocatedSurvivors++;
                soundControllerScript.playSFX("buy");
            }
        }
        else
        {
            GUI.enabled = false;
            if (GUI.Button(new Rect(x + 285, y + 100, 140, 20), "No Hoarders"))
            {
            }
        }
        GUI.enabled = true;
        //Survivors Section End
    }