Пример #1
0
        public void DisplayBuild()
        {
            Vector2 ratio = new Vector2(Screen.width / standardSize.x, Screen.height / standardSize.y);
            int     y     = 0;
            int     z     = 0;

            for (int x = 0; x < faction.BuildingList.Length; x++)
            {
                if (!faction.BuildingList[x].obj)
                {
                    continue;
                }
                // Displays the Building Name
                Rect rectLoc = new Rect(
                    (buildButtonSize.x + y * buildingBDisp.x) * ratio.x,
                    (buildButtonSize.y + z * buildingBDisp.y) * ratio.y,
                    buildButtonSize.width * ratio.x,
                    buildButtonSize.height * ratio.y);
                if (GUI.Button(rectLoc, faction.BuildingList[x].obj.GetComponent <BuildingController>().name))
                {
                    place.BeginPlace(faction.BuildingList[x]);
                }
                if (rectLoc.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
                {
                    mouseOverGUI = true;
                    mouseOverBuildingProduction = true;
                    buildingProductionIndex     = x;
                }
                y = y + 1;
                if (y < BColumnsXRows.x)
                {
                    continue;
                }
                y = 0;
                z++;
                if (z >= BColumnsXRows.y)
                {
                    break;
                }
            }
        }