Beispiel #1
0
 void OnGUI()
 {
     if (!PauseScript.sharedInstance().isPaused())
     {
         this.infoGUI();
     }
 }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (!PauseScript.sharedInstance().isPaused())
     {
         this.updateSelection();
     }
 }
Beispiel #3
0
    void OnGUI()
    {
        if (!PauseScript.sharedInstance().isPaused())
        {
            int   nButtons      = this.defensesPrefabs.Length;
            float buttonsWidth  = 120.0f;
            float startX        = Screen.width - buttonsWidth - 20.0f;
            float buttonsHeight = 35.0f;
            float buttonsSep    = 10.0f;
            float totalHeight   = (nButtons * buttonsHeight + (nButtons - 1) * buttonsSep);
            float startY        = (Screen.height - totalHeight) / 2.0f;

            float nextY = startY;
            for (int i = 0; i < nButtons; i++)
            {
                GameObject    defensePrefab = this.defensesPrefabs [i];
                DefenseScript defense       = defensePrefab.GetComponent <DefenseScript> ();
                string        buttonTitle   = (defensePrefab.name + " (" + defense.price + ")");
                if (GUI.Button(new Rect(startX, nextY, buttonsWidth, buttonsHeight), buttonTitle))
                {
                    if (this._defenseInstanceToAdd != null)
                    {
                        Destroy(this._defenseInstanceToAdd);
                        this._defenseInstanceToAdd = null;
                    }
                    this._deleting             = false;
                    this._defenseInstanceToAdd = (GameObject)Instantiate(defensePrefab, MapScript.sharedInstance().hiddenPosition(), Quaternion.identity);
                }
                nextY += (buttonsHeight + buttonsSep);
            }


            nextY += (buttonsHeight + buttonsSep);
            if (GUI.Button(new Rect(startX, nextY, buttonsWidth, buttonsHeight), "Delete"))
            {
                this._deleting = true;
                if (this._defenseInstanceToAdd != null)
                {
                    Destroy(this._defenseInstanceToAdd);
                    this._defenseInstanceToAdd = null;
                }
            }
        }
    }