From e2cdc0fa6f8d24ebf9269ad13371869642df920b Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 4 Sep 2014 16:51:29 +0100 Subject: [PATCH] Deleted legacy scripts --- Assets/Fungus/Legacy.meta | 5 - Assets/Fungus/Legacy/Prefabs.meta | 5 - Assets/Fungus/Legacy/Prefabs/Game.prefab | Bin 38280 -> 0 bytes Assets/Fungus/Legacy/Prefabs/Game.prefab.meta | 4 - Assets/Fungus/Legacy/Scripts.meta | 5 - Assets/Fungus/Legacy/Scripts/Button.cs | 153 --- Assets/Fungus/Legacy/Scripts/Button.cs.meta | 8 - Assets/Fungus/Legacy/Scripts/GUIButton.cs | 110 --- .../Fungus/Legacy/Scripts/GUIButton.cs.meta | 8 - Assets/Fungus/Legacy/Scripts/Game.cs | 113 --- Assets/Fungus/Legacy/Scripts/Game.cs.meta | 8 - Assets/Fungus/Legacy/Scripts/LegacyDialog.cs | 878 ------------------ .../Legacy/Scripts/LegacyDialog.cs.meta | 8 - 13 files changed, 1305 deletions(-) delete mode 100644 Assets/Fungus/Legacy.meta delete mode 100644 Assets/Fungus/Legacy/Prefabs.meta delete mode 100644 Assets/Fungus/Legacy/Prefabs/Game.prefab delete mode 100644 Assets/Fungus/Legacy/Prefabs/Game.prefab.meta delete mode 100644 Assets/Fungus/Legacy/Scripts.meta delete mode 100644 Assets/Fungus/Legacy/Scripts/Button.cs delete mode 100644 Assets/Fungus/Legacy/Scripts/Button.cs.meta delete mode 100644 Assets/Fungus/Legacy/Scripts/GUIButton.cs delete mode 100644 Assets/Fungus/Legacy/Scripts/GUIButton.cs.meta delete mode 100644 Assets/Fungus/Legacy/Scripts/Game.cs delete mode 100644 Assets/Fungus/Legacy/Scripts/Game.cs.meta delete mode 100644 Assets/Fungus/Legacy/Scripts/LegacyDialog.cs delete mode 100644 Assets/Fungus/Legacy/Scripts/LegacyDialog.cs.meta diff --git a/Assets/Fungus/Legacy.meta b/Assets/Fungus/Legacy.meta deleted file mode 100644 index 67f10d66..00000000 --- a/Assets/Fungus/Legacy.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: aa3f588da95e04a38bc546ee65bbd724 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Fungus/Legacy/Prefabs.meta b/Assets/Fungus/Legacy/Prefabs.meta deleted file mode 100644 index 051de10a..00000000 --- a/Assets/Fungus/Legacy/Prefabs.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: dd60c6b3baeb0475db2ac8ac965401c4 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Fungus/Legacy/Prefabs/Game.prefab b/Assets/Fungus/Legacy/Prefabs/Game.prefab deleted file mode 100644 index 7ecb1c0b3668d6ae174f4787725e1b50d5354cf3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 38280 zcmeHQ36vGZ)$VaaP*D*#79GWXK|v5BW|)O-1Z0>&h`3-g(=+qn&FhzbZw3ZI#{`wQ zL|o&RXc9FTqcJfW(V!uT3L2Lr#-NgD78kOj#+bN3?ycMP`d0NVc<0ag|398H#d*B$ zx?fe@{;KNMt=n(9J@3*+&%189=XrfS@6tScd!vSr9)5i5iQeWdTed)^_aS^w3v*#@ z(C&9-!p_L6^$URqxmys9sRIA&@w|cX)tM_~+HyflWhPhjI_6HFH$P}DPR_Ih6SIC> z!P@~K3Lby!d$NNqaatLy1bpC=yveIgvBf1 zAD&Z#6EoSMe!OaDdqhCeAUq~egI{cqL8uTW4pPcc%ZU#4xndCI{H$t!M=De*CAPnl z1;W!*`+WqEYJZa75zrN*4#}BnA34B;TGzn;V*A*8m^28FQ|RVu>XIe8sq_o2+g-I3bp>NVF(Qa=o z$M0%EyL~`_iMMTPw=V$osj4gI1Qfl?FwmSB8mcY!HDOR*q8T2&)27l_M<>o~BeeN&t~64M06tByXH6 zHIB9li)tKWf$%h?#<2p3CelJbQ$(AGvwt{8#nb2`FmPoq@Mv}|qu;y0YrBg43LVqC z!1pfjbN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deleted file mode 100644 index 5938e7f9..00000000 --- a/Assets/Fungus/Legacy/Prefabs/Game.prefab.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f6e5e4b8124614271beca06a1d6c67c2 -NativeFormatImporter: - userData: diff --git a/Assets/Fungus/Legacy/Scripts.meta b/Assets/Fungus/Legacy/Scripts.meta deleted file mode 100644 index 78eac883..00000000 --- a/Assets/Fungus/Legacy/Scripts.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: dcdd73da180864aeabbb6aaa802c9213 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Fungus/Legacy/Scripts/Button.cs b/Assets/Fungus/Legacy/Scripts/Button.cs deleted file mode 100644 index c140e121..00000000 --- a/Assets/Fungus/Legacy/Scripts/Button.cs +++ /dev/null @@ -1,153 +0,0 @@ -using UnityEngine; -using System; -using System.Collections; -using Fungus.Script; - -namespace Fungus -{ - /** - * Button click handler class for making sprites clickable. - * When the user taps on the sprite, an Action delegate method is called - */ - [RequireComponent (typeof (SpriteRenderer))] - public class Button : MonoBehaviour - { - /** - * Delegate method to call when the player clicks the button. - */ - public Action buttonAction; - - /** - * Automatically hides the button when displaying story text/options or waiting. - */ - [Tooltip("Automatically hides the button when displaying story text/options or waiting.")] - public bool autoHide = true; - - /** - * Automatically hides the button when the named boolean variable is set using SetBoolean() - */ - [Tooltip("Automatically hides the button when the named boolean variable is set using the SetBoolean() command.")] - public string hideOnBoolean; - - /** - * Sound effect to play when button is clicked. - */ - [Tooltip("Sound effect to play when button is clicked.")] - public AudioClip clickSound; - - float targetAlpha; - bool showButton; - - /** - * Set visibility of a button object and set the delegate method to call when clicked. - * If the object does not already have a Collider2D component, then a BoxCollider2D is added. - * @param _visible Setting this to true makes the button visible, unless overridden by property settings - * @param _buttonAction An Action delegate method to call when the player clicks on the button - */ - public void Show(bool _visible, Action _buttonAction) - { - SpriteRenderer spriteRenderer = renderer as SpriteRenderer; - if (spriteRenderer == null) - { - Debug.LogError("Sprite renderer must not be null"); - return; - } - - // Add a BoxCollider2d if none currently exists - if (collider2D == null) - { - gameObject.AddComponent(); - } - - showButton = _visible; - buttonAction = _buttonAction; - - if (_visible) - { - targetAlpha = 1f; - } - else - { - targetAlpha = 0f; - } - - UpdateTargetAlpha(); - } - - public void SetAlpha(float alpha) - { - SpriteRenderer spriteRenderer = renderer as SpriteRenderer; - Color color = spriteRenderer.color; - color.a = alpha; - spriteRenderer.color = color; - } - - void UpdateTargetAlpha() - { - // Automatically display button when game is in idle state (not displaying story text/options or waiting) - if (autoHide) - { - if (showButton && - Game.GetInstance().GetShowAutoButtons()) - { - targetAlpha = 1f; - - } - else - { - targetAlpha = 0f; - } - } - - // Hide the button if the specified boolean variable is true - if (hideOnBoolean.Length > 0 && - GlobalVariables.GetBoolean(hideOnBoolean)) - { - targetAlpha = 0f; - } - } - - void Update() - { - UpdateTargetAlpha(); - - SpriteRenderer spriteRenderer = renderer as SpriteRenderer; - float fadeSpeed = (1f / Game.GetInstance().buttonFadeDuration); - - float alpha = Mathf.MoveTowards(spriteRenderer.color.a, targetAlpha, Time.deltaTime * fadeSpeed);; - - // Set alpha for this sprite and any child sprites - SpriteRenderer[] children = spriteRenderer.gameObject.GetComponentsInChildren(); - foreach (SpriteRenderer child in children) - { - Color color = child.color; - color.a = alpha; - child.color = color; - } - } - - void OnMouseUpAsButton() - { - SpriteRenderer spriteRenderer = renderer as SpriteRenderer; - - // Ignore button press if sprite is not fully visible or - // if the game is not in an idle state - if (spriteRenderer.color.a != 1f || - !Game.GetInstance().GetShowAutoButtons()) - { - return; - } - - // Click sound effect - if (clickSound != null) - { - AudioSource.PlayClipAtPoint(clickSound, Vector3.zero); - } - - /* - CommandQueue commandQueue = Game.GetInstance().commandQueue; - commandQueue.CallCommandMethod(buttonAction); - */ - } - } -} \ No newline at end of file diff --git a/Assets/Fungus/Legacy/Scripts/Button.cs.meta b/Assets/Fungus/Legacy/Scripts/Button.cs.meta deleted file mode 100644 index 372a2258..00000000 --- a/Assets/Fungus/Legacy/Scripts/Button.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1fe346be2e3e54b0b8ec94f09bb152a4 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Fungus/Legacy/Scripts/GUIButton.cs b/Assets/Fungus/Legacy/Scripts/GUIButton.cs deleted file mode 100644 index a6595663..00000000 --- a/Assets/Fungus/Legacy/Scripts/GUIButton.cs +++ /dev/null @@ -1,110 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Fungus -{ - /** - * Draws a GUI button at a consistent size regardless of screen resolution. - * The button can be positioned anywhere on the screen using normalized screen coords. - * Vertical and horizontal padding can be applied to offset the button away from the screen edge. - * Several options are available for handling the player click action. - */ - public class GUIButton : MonoBehaviour - { - /// Button texture to draw on the screen. - [Tooltip("Button texture to draw on the screen.")] - public Texture2D texture; - - /// Button size as a fraction of screen height [0..1]. - [Range(0, 1)] - [Tooltip("Button size as a fraction of screen height [0..1].")] - public float verticalScale = 0.2f; - - /// Texture position on screen in localized screen coords [0..1] - [Tooltip("Texture position on screen in localized screen coords [0..1]")] - public Vector2 screenPosition; - - /// Space between edge of screen and texture (in pixels). - [Tooltip("Space between edge of screen and texture (in pixels).")] - public Vector2 padding; - - /// Supported actions to perform when player clicks the button. - public enum ClickAction - { - /// Perform no action, useful when you just want to display a sprite in screen space. - None, - /// Open the URL specified in actionParameter in the browser - OpenURL, - /// Call a method specified by actionParameter on all Room objects in the scene. - SendMessage - }; - - /// Action to perform when player clicks the button. - [Tooltip("Action to perform when player clicks the button.")] - public ClickAction clickAction; - - /// Parameter associated with the click action. - [Tooltip("Parameter associated with the click action.")] - public string actionParameter; - - void OnGUI() - { - if (texture == null) - { - return; - } - - // Calc initial center point - float x = screenPosition.x * Screen.width; - float y = screenPosition.y * Screen.height; - - // Height is calculated as a fraction of screen height for resolution independent sizing. - // Width is then calculated so as to maintain the original aspect ratio of the texture. - float height = Screen.height * verticalScale; - float width = texture.width * (height / texture.height); - - // Calc initial rect for rendering texture - float x1 = x - width / 2f; - float y1 = y - height / 2f; - float x2 = x + width / 2f; - float y2 = y + height / 2f; - - // Adjust rect to fit on screen, and apply vertical & horizontal padding - if (x1 < padding.x) - { - x1 = padding.x; - x2 = x1 + width; - } - if (x2 > Screen.width - padding.x) - { - x2 = Screen.width - padding.x; - x1 = x2 - width; - } - if (y1 < padding.y) - { - y1 = padding.y; - y2 = y1 + height; - } - if (y2 > Screen.height - padding.y) - { - y2 = Screen.height - padding.y; - y1 = y2 - height; - } - - // Draw the texture - Rect textureRect = new Rect(x1, y1, x2 - x1, y2 - y1); - if (GUI.Button(textureRect, texture, new GUIStyle())) - { - switch (clickAction) - { - case ClickAction.OpenURL: - Application.OpenURL(actionParameter); - break; - case ClickAction.SendMessage: - // TODO: Execute a sequence - break; - } - } - } - } -} diff --git a/Assets/Fungus/Legacy/Scripts/GUIButton.cs.meta b/Assets/Fungus/Legacy/Scripts/GUIButton.cs.meta deleted file mode 100644 index a44847b1..00000000 --- a/Assets/Fungus/Legacy/Scripts/GUIButton.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8ea93591566a948c1bb46ec405d87bb5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Fungus/Legacy/Scripts/Game.cs b/Assets/Fungus/Legacy/Scripts/Game.cs deleted file mode 100644 index 88e183f1..00000000 --- a/Assets/Fungus/Legacy/Scripts/Game.cs +++ /dev/null @@ -1,113 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System; -using System.Runtime.Serialization.Formatters.Binary; -using System.IO; -using Fungus.Script; - -/** - * @package Fungus An open source library for Unity 3D for creating graphic interactive fiction games. - */ -namespace Fungus -{ - /** - * Manages global game state and movement between rooms. - */ - [RequireComponent(typeof(LegacyDialog))] - public class Game : MonoBehaviour - { - /** - * Fade transition time when hiding/showing buttons. - */ - [Range(0,5)] - [Tooltip("Fade transition time when hiding/showing buttons.")] - public float buttonFadeDuration = 0.25f; - - /** - * Time to elapse before buttons hide automatically. - */ - [Range(0, 60)] - [Tooltip("Time to elapse before buttons hide automatically.")] - public float autoHideButtonDuration = 5f; - - /** - * Currently active Dialog object used to display character text and menus. - */ - [Tooltip("Currently active Dialog object used to display character text and menus.")] - public LegacyDialog dialog; - - float autoHideButtonTimer; - - static Game instance; - - /** - * Returns the singleton instance for the Game class - */ - public static Game GetInstance() - { - if (!instance) - { - instance = GameObject.FindObjectOfType(typeof(Game)) as Game; - if (!instance) - { - Debug.LogError("There must be one active Game object in your scene."); - } - } - - return instance; - } - - public virtual void Start() - { - // Auto-hide buttons should be visible at start of game - autoHideButtonTimer = autoHideButtonDuration; - } - - public virtual void Update() - { - autoHideButtonTimer -= Time.deltaTime; - autoHideButtonTimer = Mathf.Max(autoHideButtonTimer, 0f); - - if (Input.GetMouseButtonDown(0)) - { - autoHideButtonTimer = autoHideButtonDuration; - } - } - - public IDialog GetDialog() - { - if (dialog != null) - { - return dialog as IDialog; - } - - return null; - } - - /** - * Returns true if the game should display 'auto hide' buttons. - * Buttons will be displayed if the game is not currently displaying story text/options, and no Wait command is in progress. - */ - public bool GetShowAutoButtons() - { - CameraController cameraController = CameraController.GetInstance(); - - if (cameraController.waiting) - { - return false; - } - - IDialog dialog = GetDialog(); - - if (dialog == null || - dialog.GetDialogMode() == DialogMode.Idle) - { - return (autoHideButtonTimer > 0f); - } - - return false; - } - } -} \ No newline at end of file diff --git a/Assets/Fungus/Legacy/Scripts/Game.cs.meta b/Assets/Fungus/Legacy/Scripts/Game.cs.meta deleted file mode 100644 index be458afc..00000000 --- a/Assets/Fungus/Legacy/Scripts/Game.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 05e21cf853d714e3ab419e2573b64951 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Fungus/Legacy/Scripts/LegacyDialog.cs b/Assets/Fungus/Legacy/Scripts/LegacyDialog.cs deleted file mode 100644 index d455c04c..00000000 --- a/Assets/Fungus/Legacy/Scripts/LegacyDialog.cs +++ /dev/null @@ -1,878 +0,0 @@ -using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Fungus -{ - /** - * Permitted states for Dialogs. - */ - public enum DialogMode - { - /// Dialog has no pending content to display so is not shown. - Idle, - /// Dialog is currently writing out content. - Writing, - /// Dialog has finished writing out content and is waiting for player input. - Waiting - } - - /** - * Interface for Dialog implementations. - * This allows us to introduce new types of Dialog in future. - */ - public interface IDialog - { - /** - * Returns the current state of the Dialog. - */ - DialogMode GetDialogMode(); - - /** - * Display a line of story text. - * If any options have previously been added using AddOption(), these will be displayed and the - * user must choose an option to continue. The sayAction parameter is ignored - * @param sayText The line of story text to be displayed. - * @param sayAction Delegate method to call when the player taps to continue. - */ - void Say(string sayText, Action sayAction); - - /** - * Clear the current list of options previously added using AddOption(). - */ - void ClearOptions(); - - /** - * Add an option to the list of options to be displayed on the next call to Say(). - * @param optionText Text to display on the button for the option. - * @param optionAction Delegate method to call when the option button is pressed. - */ - void AddOption(string optionText, Action optionAction); - - /** - * Sets a time limit for the player to choose between multiple options. - * If the player fails to make a choice in time then the timeoutAction delegate method is called. - * This setting only applies to the next Say() command and will be reset afterwards. - * @timeoutDuration Length of time for the player to choose an option. - * @timeoutAction Delegate method to call when player fails to choose an option. - */ - void SetTimeout(float timeoutDuration, Action timeoutAction); - } - - [ExecuteInEditMode] - public class LegacyDialog : MonoBehaviour, IDialog - { - /** - * Padding values for each side of the dialog. - * Values are in normalized screen coords [0..1] - */ - [Serializable] - public class Layout - { - /** - * Push the left dialog edge away from the left side of the screen. - */ - [Tooltip("Push the left dialog edge away from the left side of the screen.")] - public bool leftSpace = false; - - /** - * Push the top dialog edge away from the top side of the screen. - */ - [Tooltip("Push the top dialog edge away from the top side of the screen.")] - public bool topSpace = true; - - /** - * Push the right dialog edge away from the right side of the screen. - */ - [Tooltip("Push the right dialog edge away from the right side of the screen.")] - public bool rightSpace = false; - - /** - * Push the bottom dialog edge away from the bottom side of the screen. - */ - [Tooltip("Push the bottom dialog edge away from the bottom side of the screen.")] - public bool bottomSpace = false; - - /** - * Minimum dimensions of the dialog in normalized screen coordinates [0..1]. - * The dialog may expand beyond these dimensions to fit content. - */ - [Tooltip("Minimum dimensions of the dialog in normalized screen coordinates [0..1].")] - public Vector2 size = new Vector2(1f, 0.25f); - - /** - * Offset the dialog relative to the top left corner of the screen. - * Coordinates are in normalized screen coordinates [0..1] - */ - [Tooltip("Offset the dialog relative to the top left corner of the screen.")] - public Vector2 offset; - } - - /** - * Layout values used to control size and position of the dialog. - */ - [Tooltip("Layout values used to control size and position of the dialog.")] - public Layout layout; - - /** - * Defines the dialog display properties of a game character. - */ - [System.Serializable] - public class Character - { - /** - * Side of screen to display character image. - */ - public enum ImageSide - { - /// Display image on the left side of the dialog. - Left, - /// Display image on the right side of the dialog. - Right - } - - /** - * Identifier for this character for use with the SetCharacter() command. - */ - [Tooltip("Identifier for this character for use with the SetCharacter() command.")] - public string characterID; - - /** - * Name text to display for the character on the dialog. - * If empty then the name field is not displayed. - */ - [Tooltip("Name text to display for the character on the dialog.")] - public string name; - - /** - * The color of the name text label. - * This always overrides any color value specified in the NameStyle property. - */ - [Tooltip("The color of the name text label.")] - public Color nameColor; - - /** - * Image to display for the character. - * If no image is specified then no character image will be displayed. - */ - [Tooltip("Image to display for the character.")] - public Texture2D image; - - /** - * Side of dialog where character image will be displayed. - */ - [Tooltip("Side of dialog where character image will be displayed.")] - public ImageSide imageSide; - } - - /** - * List of game characters that can be displayed using this dialog. - */ - [Tooltip("List of game characters that can be displayed using this dialog.")] - public Character[] characters; - - /** - * Active character to use when displaying dialog (set using the SetCharacter() command). - */ - [Tooltip("Active character to use when displaying dialog.")] - public int activeCharacter; - - /** - * Writing speed for say text in characters per second. - */ - [Range(0, 1000)] - [Tooltip("Writing speed for say text in characters per second.")] - public int writingSpeed = 100; - - /** - * Sound to play while text is being written in the dialog. - */ - [Tooltip("Sound to play while text is being written in the dialog.")] - public AudioClip writingSound; - - /** - * Loop the writing sound as long as text is being written. - */ - [Tooltip("Loop the writing sound while text is being written.")] - public bool loopWritingSound = true; - - /** - * Sound effect to play when the player taps to continue. - */ - [Tooltip("Sound effect to play when the player taps to continue.")] - public AudioClip continueSound; - - /** - * Icon to display under the story text when waiting for player to tap to continue. - */ - [Tooltip("Icon to display under the story text when waiting for player to tap to continue.")] - public Texture2D continueIcon; - - /** - * Number of buttons to display in the same row when showing multiple options. - */ - [Range(0, 10)] - [Tooltip("Number of buttons to display in the same row when showing multiple options.")] - public int buttonsPerRow = 2; - - /** - * Minimum width of each button as a fraction of the screen width [0..1]. - * This is useful to create a column of buttons with matching width. - */ - [Range(0, 1)] - [Tooltip("Minimum width of each button as a fraction of the screen width [0..1].")] - public float minButtonWidth = 0; - - /** - * Padding values for each side of the character image. - */ - [System.Serializable] - public class ImagePadding - { - /** - * Padding to apply to left side of image as a fraction of screen height [-2..2]. - */ - [Range(-2,2)] - [Tooltip("Padding to apply to left side of image as a fraction of screen height [-2..2].")] - public float left; - - /** - * Padding to apply to right side of image as a fraction of screen height [-2..2]. - */ - [Range(-2,2)] - [Tooltip("Padding to apply to right side of image as a fraction of screen height [-2..2].")] - public float right; - - /** - * Padding to apply to top side of image as a fraction of screen height [-1..1]. - */ - [Range(-1,1)] - [Tooltip("Padding to apply to top side of image as a fraction of screen height [-1..1].")] - public float top; - - /** - * Padding to apply to bottom side of image as a fraction of screen height [-1..1]. - */ - [Range(-1,1)] - [Tooltip("Padding to apply to bottom side of image as a fraction of screen height [-1..1].")] - public float bottom; - } - - /** - * Padding offset to apply around the character image. - */ - [Tooltip("Padding offset to apply around the character image.")] - public ImagePadding imagePadding; - - /** - * Scale of character image, specified as a fraction of current screen height [0..1]. - */ - [Range(0, 1)] - [Tooltip("Scale of character image, specified as a fraction of current screen height [0..1].")] - public float imageScale = 0.25f; - - /** - * Animation frames for multiple choice time indicator. - */ - [Tooltip("Animation frames for multiple choice time indicator.")] - public Texture2D[] timerAnimation; - - /** - * Scale of timer image, specified as a fraction of current screen height [0..1]. - */ - [Range(0, 1)] - [Tooltip("Scale of timer image, specified as a fraction of current screen height [0..1].")] - public float timerScale = 0.2f; - - /** - * Sound effect to play when time indicator advances. - */ - [Tooltip("Sound effect to play when time indicator advances.")] - public AudioClip timerSound; - - /** - * Style for dialog box background. - */ - [Tooltip("Style for dialog box background.")] - public GUIStyle boxStyle; - - /** - * Style for name text. - */ - [Tooltip("Style for name text.")] - public GUIStyle nameTextStyle; - - /** - * Style for say text. - */ - [Tooltip("Style for say text.")] - public GUIStyle sayTextStyle; - - /** - * Style for option buttons - */ - [Tooltip("Style for option buttons.")] - public GUIStyle buttonStyle; - - DialogMode dialogMode; - - public DialogMode GetDialogMode() - { - return dialogMode; - } - - class Option - { - public string optionText; - public Action optionAction; - - public Option(string _optionText, Action _optionAction) - { - optionText = _optionText; - optionAction = _optionAction; - } - } - - List