private void DrawBuildQueue(StructureController selectedStructure) { if (selectedStructure == null) { return; } string[] buildQueue = selectedStructure.GetBuildQueueEntries(); float buildPercentage = selectedStructure.GetBuildCompletionPercentage(); for (int i = 0; i < buildQueue.Length; i++) { float topEdge = i * BUILD_IMAGE_HEIGHT - (i + 1) * BUILD_IMAGE_PADDING; Rect buildArea = new Rect(BUILD_IMAGE_PADDING, topEdge, BUILD_IMAGE_WIDTH, BUILD_IMAGE_HEIGHT); string unitName = buildQueue[i]; Texture2D unitIcon = GameManager.activeInstance.GetBuildIcon(unitName); GUI.DrawTexture(buildArea, unitIcon); GUI.DrawTexture(buildArea, buildFrame); topEdge += BUILD_IMAGE_PADDING; float width = BUILD_IMAGE_WIDTH - 2 * BUILD_IMAGE_PADDING; float height = BUILD_IMAGE_HEIGHT - 2 * BUILD_IMAGE_PADDING; if (i == 0) { // Shrink the build mask on the time currently being built to give an idea of progress topEdge += height * buildPercentage; height *= (1 - buildPercentage); } int leftEdge = 2 * BUILD_IMAGE_PADDING; GUI.DrawTexture(new Rect(leftEdge, topEdge, width, height), buildMask); } }