Ejemplo n.º 1
0
 private void OnEnable()
 {
     if (AdvGame.GetReferences () && AdvGame.GetReferences ().speechManager)
     {
         speechManager = AdvGame.GetReferences ().speechManager;
     }
 }
Ejemplo n.º 2
0
		private void Awake ()
		{
			playerInput = this.GetComponent <PlayerInput>();
			
			if (AdvGame.GetReferences () == null)
			{
				Debug.LogError ("A References file is required - please use the Adventure Creator window to create one.");
			}
			else
			{
				speechManager = AdvGame.GetReferences ().speechManager;
				
				if (speechManager.textScrollSpeed == 0f)
				{
					Debug.LogError ("Cannot have a Text Scroll Speed of zero - please amend your Speech Manager");
				}
			}
			
			if (this.GetComponent <SceneSettings>() && this.GetComponent <SceneSettings>().defaultSound && this.GetComponent <SceneSettings>().defaultSound.GetComponent <AudioSource>())
			{
				defaultAudioSource = this.GetComponent <SceneSettings>().defaultSound.GetComponent <AudioSource>();
			}
		}
Ejemplo n.º 3
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;
		}
Ejemplo n.º 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 ();
        }
Ejemplo n.º 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;
		}
Ejemplo n.º 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>();
		}
Ejemplo n.º 7
0
		private void OnDestroy ()
		{
			playerInput = null;
			speakerChar = null;
			speechManager = null;
			defaultAudioSource = null;
		}
Ejemplo n.º 8
0
		protected void GetSettingsManager ()
		{
			if (AdvGame.GetReferences () && AdvGame.GetReferences ().settingsManager)
			{
				settingsManager = AdvGame.GetReferences ().settingsManager;
			}
			if (AdvGame.GetReferences () && AdvGame.GetReferences ().speechManager)
			{
				speechManager = AdvGame.GetReferences ().speechManager;
			}
		}