Exemplo n.º 1
0
		private void Awake ()
		{
			SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager;
			LayerHotspot = LayerMask.NameToLayer (settingsManager.hotspotLayer);
			LayerOff = LayerMask.NameToLayer (settingsManager.deactivatedLayer);
			
			if (GameObject.FindWithTag (Tags.gameEngine) && GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>())
			{
				actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();
			}
			
			// If asset-based, download actions
			if (source == ActionListSource.AssetFile)
			{
				actions.Clear ();
				if (assetFile != null && assetFile.actions.Count > 0)
				{
					foreach (AC.Action action in assetFile.actions)
					{
						actions.Add (action);
					}
					useParameters = assetFile.useParameters;
					parameters = assetFile.parameters;
				}
			}
			
			if (useParameters)
			{
				// Reset all parameters
				foreach (ActionParameter _parameter in parameters)
				{
					_parameter.Reset ();
				}
			}
		}
Exemplo n.º 2
0
        public static void SetGameEngine(GameObject _gameEngine = null)
        {
            if (_gameEngine != null)
            {
                gameEnginePrefab = _gameEngine;

                menuSystemComponent        = null;
                playerCursorComponent      = null;
                playerInputComponent       = null;
                playerInteractionComponent = null;
                playerMovementComponent    = null;
                playerMenusComponent       = null;
                playerQTEComponent         = null;
                kickStarterComponent       = null;
                sceneSettingsComponent     = null;
                dialogComponent            = null;
                menuPreviewComponent       = null;
                navigationManagerComponent = null;
                actionListManagerComponent = null;
                localVariablesComponent    = null;
                eventManagerComponent      = null;

                return;
            }

            if (gameEnginePrefab == null)
            {
                SceneSettings sceneSettings = UnityVersionHandler.GetKickStarterComponent <SceneSettings>();
                if (sceneSettings != null)
                {
                    gameEnginePrefab = sceneSettings.gameObject;
                }
            }
        }
Exemplo n.º 3
0
		protected override void Awake ()
		{
			base.Awake ();

			actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();

			if (_rigidbody)
			{
				SetGravity (true);
			}

			if (GetComponent <SphereCollider>())
			{
				colliderRadius = GetComponent <SphereCollider>().radius * transform.localScale.x;
			}
		}
Exemplo 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;
            actionListAssetManagerComponent = 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;
            eventManagerComponent      = null;

            SetGameEngine();
        }
Exemplo n.º 5
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 ();
        }
Exemplo n.º 6
0
		private void OnDestroy ()
		{
			actionListManager = null;
			stateHandler = null;
		}
Exemplo n.º 7
0
		private void BeginActionList (int i)
		{
			if (actionListManager == null)
			{
				actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();
			}
			actionListManager.AddToList (this);
			
			nextActionNumber = i;
			ProcessAction (i);
		}
 void Start()
 {
     _AC = new ActionListManager();
 }
Exemplo n.º 9
0
        public void Start()
        {
            bridge = DialogueManager.Instance.GetComponent<AdventureCreatorBridge>();
            actionListManager = KickStarter.actionListManager;
            string actionListSpecifier = GetParameter(0);
            bool wait = !string.Equals(GetParameter(1), "nowait");
            int startAt = GetParameterAsInt(2);
            bool addToSkipQueue = true;

            // Look for a GameObject in the scene matching the specified name:
            GameObject actionListObject = GameObject.Find(actionListSpecifier);
            if (actionListObject != null) {
                actionList = actionListObject.GetComponent<ActionList>();
                if (actionList != null) {
                    if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt), actionListObject);
                    if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator();
                    if (startAt == 0) {
                        actionList.Interact();
                    } else {
                        actionList.Interact(startAt, addToSkipQueue);
                    }
                }
            }

            // Failing that, look for other GameObjects in the scene matching the name:
            if (actionList == null) {
                foreach (GameObject go in GameObject.FindObjectsOfType<GameObject>()) {
                    if (string.Equals(go.name, actionListSpecifier)) {
                        actionList = go.GetComponent<ActionList>();
                        if (actionList != null) {
                            if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt), go);
                            if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator();
                            if (startAt == 0) {
                                actionList.Interact();
                            } else {
                                actionList.Interact(startAt, addToSkipQueue);
                            }
                            break;
                        }
                    }
                }
            }

            // Failing that, try Resources.Load:
            if (actionList == null) {
                var actionListAsset = Resources.Load(actionListSpecifier) as ActionListAsset;
                if (actionListAsset) {
                    if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list asset", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt));
                    if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator();
                    if (startAt == 0) {
                        actionList = AdvGame.RunActionListAsset(actionListAsset);
                    } else {
                        actionList = AdvGame.RunActionListAsset(actionListAsset, startAt, addToSkipQueue);
                    }
                }
            }

            // Failing that, look for an ActionListAsset in all resources of the project:
            if (actionList == null) {
                foreach (ActionListAsset actionListAsset in Resources.FindObjectsOfTypeAll(typeof(ActionListAsset)) as ActionListAsset[]) {
                    if (string.Equals(actionListSpecifier, actionListAsset.name, System.StringComparison.OrdinalIgnoreCase)) {
                        if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list asset", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt));
                        if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator();
                        if (startAt == 0) {
                            actionList = AdvGame.RunActionListAsset(actionListAsset);
                        } else {
                            actionList = AdvGame.RunActionListAsset(actionListAsset, startAt, addToSkipQueue);
                        }
                        break;
                    }
                }
            }

            if (actionList == null) {
                if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AC(): Can't find action list '{1}'", DialogueDebug.Prefix, actionListSpecifier));
                Stop();
            }
            if (!wait) Stop();
        }
Exemplo n.º 10
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;
		}
Exemplo n.º 11
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>();
		}
Exemplo n.º 12
0
		private void Awake ()
		{
			if (AdvGame.GetReferences () && AdvGame.GetReferences ().settingsManager)
			{
				settingsManager = AdvGame.GetReferences ().settingsManager;
				cursorIsLocked = settingsManager.lockCursorOnStart;
			}
			
			actionListManager = this.GetComponent <ActionListManager>();
			playerInteraction = this.GetComponent <PlayerInteraction>();
			
			ResetClick ();
			
			xboxCursor.x = Screen.width / 2;
			xboxCursor.y = Screen.height / 2;
		}
Exemplo n.º 13
0
		private void OnDestroy ()
		{
			stateHandler = null;
			runtimeInventory = null;
			settingsManager = null;
			actionListManager = null;
			playerInteraction = null;
		}
Exemplo n.º 14
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[];
		}
Exemplo n.º 15
0
		private void OnDestroy ()
		{
			playerInput = null;
			playerCursor = null;
			playerMenus = null;
			playerInteraction = null;
			playerMovement = null;
			settingsManager = null;
			arrowPrompts = null;
			hotspots = null;
			actionListManager = null;
			dialog = null;
		}
Exemplo n.º 16
0
		protected void PathUpdate ()
		{
			if (activePath && activePath.nodes.Count > 0)
			{
				if (pausePath)
				{
					if (nodeActionList != null)
					{
						if (actionListManager == null)
						{
							actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();
						}
						
						if (!actionListManager.IsListRunning (nodeActionList))
						{
							SetNextNodes ();
						}
					}
					else if (Time.time > pausePathTime)
					{
						SetNextNodes ();
					}
					return;
				}
				else
				{
					Vector3 direction = activePath.nodes[targetNode] - transform.position;
					Vector3 lookDir = new Vector3 (direction.x, 0f, direction.z);
					
					if (settingsManager && settingsManager.IsUnity2D ())
					{
						direction.z = 0f;
						SetMoveDirection (direction);
						lookDir = new Vector3 (direction.x, 0f, direction.y);
						SetLookDirection (lookDir, false);
					}
					else if (activePath.affectY)
					{
						SetMoveDirection (direction);
						SetLookDirection (lookDir, false);
					}
					else
					{
						SetLookDirection (lookDir, false);
						SetMoveDirectionAsForward ();
					}
					
					float nodeThreshold = 0.1f;
					if (settingsManager)
					{
						nodeThreshold = 1.05f - settingsManager.destinationAccuracy;
					}
					if (isRunning)
					{
						nodeThreshold *= runSpeedScale / walkSpeedScale;
					}
					
					if ((settingsManager.IsUnity2D () && direction.magnitude < nodeThreshold) ||
					    (activePath.affectY && direction.magnitude < nodeThreshold) ||
					    (!activePath.affectY && lookDir.magnitude < nodeThreshold))
					{
						if (targetNode == 0 && prevNode == 0)
						{
							SetNextNodes ();
						}
						else if (activePath.nodePause > 0f)
						{
							PausePath (activePath.nodePause);
						}
						else if (activePath.nodeCommands.Count > targetNode)
						{
							if (activePath.commandSource == ActionListSource.InScene && activePath.nodeCommands [targetNode].cutscene != null)
							{
								PausePath (activePath.nodeCommands [targetNode].cutscene, activePath.nodeCommands [targetNode].parameterID);
							}
							else if (activePath.commandSource == ActionListSource.AssetFile && activePath.nodeCommands [targetNode].actionListAsset != null)
							{
								PausePath (activePath.nodeCommands [targetNode].actionListAsset, activePath.nodeCommands [targetNode].parameterID);
							}
							else
							{
								SetNextNodes ();
							}
						}
						else
						{
							SetNextNodes ();
						}
					}
				}
			}
		}