/// <summary> /// Draws the given <see cref="ItemReveal"/> on the GUI. /// </summary> private void DrawItemReveal(ItemReveal narration) { var style = GUI.skin.GetStyle("narrationText"); var textContent = new GUIContent(narration.Text + "\n\n" + narration.Footer); var textSize = style.CalcSize(textContent); var windowStyle = GUI.skin.GetStyle("itemWindow"); var windowWidth = windowStyle.padding.horizontal + narration.Image.width; var windowHeight = windowStyle.padding.vertical + textSize.y + narration.Image.height + 100; _itemWindow = new Rect(GUIManager.Instance.NativeWidth / 2 - windowWidth / 2, GUIManager.Instance.NativeHeight / 2 - windowHeight / 2, windowWidth, windowHeight); var originalColor = GUI.color; var color = Color.white; color.a = Mathf.Clamp01(ItemRevealBackgroundAlpha); GUI.color = color; _itemWindow = GUI.Window(0, _itemWindow, DrawItemRevealWindow, "Item Found", windowStyle); GUI.color = originalColor; }
/// <summary> /// Plays the given <see cref="ItemReveal"/> narration. /// </summary> public void RevealItem(ItemReveal itemReveal) { Narrate(itemReveal); }