Пример #1
0
		override public float Run ()
		{
			if (speechManager == null)
			{
				speechManager = AdvGame.GetReferences ().speechManager;
			}
			if (speechManager == null)
			{
				Debug.Log ("No Speech Manager present");
				return 0f;
			}

			dialog = GameObject.FindWithTag(Tags.gameEngine).GetComponent <Dialog>();
			stateHandler = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <StateHandler>();

			if (dialog && stateHandler)
			{
				if (!isRunning)
				{
					stopAction = false;
					isRunning = true;
					splitDelay = false;
					splitNumber = 0;
					
					endTime = Time.time + StartSpeech ();

					if (isBackground)
					{
						isRunning = false;
						return 0f;
					}
					return defaultPauseTime;
				}
				else
				{
					if (stopAction)
					{
						isRunning = false;
						return 0;
					}

					if (!dialog.isMessageAlive)
					{
						if (speechManager.separateLines)
						{
							if (!splitDelay)
							{
								// Begin pause if more lines are present
								splitNumber ++;
								string[] textArray = messageText.Split ('\n');
								if (textArray.Length > splitNumber)
								{
									// Still got more to go, so pause for a moment
									splitDelay = true;
									return speechManager.separateLinePause;
								}
								// else finished
							}
							else
							{
								// Show next line
								splitDelay = false;
								endTime = Time.time + StartSpeech ();
								return defaultPauseTime;
							}
						}

						if (waitTimeOffset <= 0f)
						{
							isRunning = false;
							return 0f;
						}
						else
						{
							stopAction = true;
							return waitTimeOffset;
						}
					}
					else
					{
						if (speechManager.displayForever || dialog.pauseGap)
						{
							return defaultPauseTime;
						}

						if (speechManager.separateLines)
						{
							return defaultPauseTime;
						}

						if (!dialog.HasPausing ())
						{
							// Ignore this if we're using [wait] tokens
							if (Time.time < endTime)
							{
								return defaultPauseTime;
							}
							else
							{
								isRunning = false;
								return 0f;
							}
						}
					}
				}
			}
			
			return 0f;
		}
Пример #2
0
		public override string GetLabel (int slot)
		{
			if (labelType == AC_LabelType.Normal)
			{
				return TranslateLabel (label);
			}
			else if (labelType == AC_LabelType.DialogueSpeaker)
			{
				if (dialog == null)
				{
					dialog = GameObject.FindWithTag (Tags.gameEngine).GetComponent <Dialog>();
				}
				return dialog.GetSpeaker ();
			}
			else if (labelType == AC_LabelType.DialoguePortrait)
			{
				if (dialog == null)
				{
					dialog = GameObject.FindWithTag (Tags.gameEngine).GetComponent <Dialog>();
				}
				return dialog.GetSpeaker ();
			}
			else if (labelType == AC_LabelType.GlobalVariable)
			{
				return RuntimeVariables.GetVariable (variableID).GetValue ();
			}
			else if (labelType == AC_LabelType.Hotspot)
			{
				if (playerMenus == null)
				{
					playerMenus = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <PlayerMenus>();
				}
				return playerMenus.GetHotspotLabel ();
			}

			return "";
		}
Пример #3
0
		public override void RecalculateSize ()
		{
			if (Application.isPlaying)
			{
				if (GameObject.FindWithTag (Tags.gameEngine))
				{
					dialog = GameObject.FindWithTag (Tags.gameEngine).GetComponent <Dialog>();
				}
				if (GameObject.FindWithTag (Tags.persistentEngine))
				{
					playerMenus = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <PlayerMenus>();
				}
			}
			base.RecalculateSize ();
		}
Пример #4
0
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab = null;
            mainCameraPrefab = null;
            persistentEnginePrefab = null;
            gameEnginePrefab = null;

            // Managers
            sceneManagerPrefab = null;
            settingsManagerPrefab = null;
            actionsManagerPrefab = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab = null;
            cursorManagerPrefab = null;
            menuManagerPrefab = null;

            // PersistentEngine components
            optionsComponent = null;
            runtimeInventoryComponent = null;
            runtimeVariablesComponent = null;
            playerMenusComponent = null;
            stateHandlerComponent = null;
            sceneChangerComponent = null;
            saveSystemComponent = null;
            levelStorageComponent = null;
            runtimeLanguagesComponent = null;

            // GameEngine components
            menuSystemComponent = null;
            dialogComponent = null;
            playerInputComponent = null;
            playerInteractionComponent = null;
            playerMovementComponent = null;
            playerCursorComponent = null;
            playerQTEComponent = null;
            sceneSettingsComponent = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent = null;
            menuPreviewComponent = null;

            SetGameEngine ();
        }
Пример #5
0
		private void OnDestroy ()
		{
			actionListManager = null;
			dialog = null;
			playerInput = null;
			playerInteraction = null;
			menuSystem = null;
			stateHandler = null;
			options = null;
			menus = null;
			runtimeInventory = null;
			settingsManager = null;
			cursorManager = null;
			speechManager = null;
			menuManager = null;
			sceneSettings = null;
		}
Пример #6
0
		private void GetReferences ()
		{
			settingsManager = AdvGame.GetReferences ().settingsManager;
			if (settingsManager.IsInLoadingScene ())
			{
				return;
			}
			
			speechManager = AdvGame.GetReferences ().speechManager;
			cursorManager = AdvGame.GetReferences ().cursorManager;
			menuManager = AdvGame.GetReferences ().menuManager;
			
			playerCursor = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerCursor>();
			actionListManager = playerCursor.GetComponent <ActionListManager>();
			playerInput = playerCursor.GetComponent <PlayerInput>();
			playerInteraction = playerCursor.GetComponent <PlayerInteraction>();
			menuSystem = playerCursor.GetComponent <MenuSystem>();
			dialog = playerCursor.GetComponent <Dialog>();
			sceneSettings = playerCursor.GetComponent <SceneSettings>();
			
			stateHandler = this.GetComponent <StateHandler>();
			options = this.GetComponent <Options>();
			runtimeInventory = this.GetComponent <RuntimeInventory>();
		}
Пример #7
0
		private void GetReferences ()
		{
			settingsManager = AdvGame.GetReferences ().settingsManager;

			if (settingsManager != null && settingsManager.IsInLoadingScene ())
			{
				return;
			}

			playerCursor = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerCursor>();
			playerInput = playerCursor.GetComponent <PlayerInput>();
			playerInteraction = playerCursor.GetComponent <PlayerInteraction>();
			playerMovement = playerCursor.GetComponent <PlayerMovement>();
			dialog = playerCursor.GetComponent <Dialog>();

			playerMenus = GetComponent <PlayerMenus>();

			actionListManager = playerCursor.GetComponent <ActionListManager>();

			dragBases = FindObjectsOfType (typeof (DragBase)) as DragBase[];
			hotspots = FindObjectsOfType (typeof (Hotspot)) as Hotspot[];
			arrowPrompts = FindObjectsOfType (typeof (ArrowPrompt)) as ArrowPrompt[];
			parallax2Ds = FindObjectsOfType (typeof (Parallax2D)) as Parallax2D[];
		}
Пример #8
0
		private void OnDestroy ()
		{
			playerInput = null;
			playerCursor = null;
			playerMenus = null;
			playerInteraction = null;
			playerMovement = null;
			settingsManager = null;
			arrowPrompts = null;
			hotspots = null;
			actionListManager = null;
			dialog = null;
		}