private void Start ()
		{
			if (GameObject.FindWithTag (Tags.persistentEngine) && GameObject.FindWithTag (Tags.persistentEngine).GetComponent <StateHandler>())
			{
				stateHandler = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <StateHandler>();
			}
			
			if (GameObject.FindWithTag (Tags.persistentEngine) && GameObject.FindWithTag (Tags.persistentEngine).GetComponent <RuntimeInventory>())
			{
				runtimeInventory = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <RuntimeInventory>();
			}
			
			if (GameObject.FindWithTag (Tags.persistentEngine) && GameObject.FindWithTag (Tags.persistentEngine).GetComponent <PlayerMenus>())
			{
				playerMenus = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <PlayerMenus>();
			}
		}
Beispiel #2
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();
        }
Beispiel #3
0
        private List<InvItem> AssignInventory(RuntimeInventory _runtimeInventory, string inventoryData)
        {
            List<InvItem> invItems = new List<InvItem>();

            if (inventoryData != null && inventoryData.Length > 0)
            {
                string[] countArray = inventoryData.Split ("|"[0]);

                foreach (string chunk in countArray)
                {
                    string[] chunkData = chunk.Split (":"[0]);

                    int _id = 0;
                    int.TryParse (chunkData[0], out _id);

                    int _count = 0;
                    int.TryParse (chunkData[1], out _count);

                    invItems = _runtimeInventory.Add (_id, _count, invItems, false);
                }
            }

            return invItems;
        }
		private void OnDestroy ()
		{
			playerInput = null;
			stateHandler = null;
			runtimeInventory = null;
		}
		private void Start ()
		{
			AssignFPCamera ();
			playerMenus = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <PlayerMenus>();
			runtimeInventory = playerMenus.GetComponent <RuntimeInventory>();
		}
Beispiel #6
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 ();
        }
		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;
		}
		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>();
		}
		private void OnDestroy ()
		{
			stateHandler = null;
			runtimeInventory = null;
			settingsManager = null;
			actionListManager = null;
			playerInteraction = null;
		}
		private void Start ()
		{
			if (GameObject.FindWithTag (Tags.persistentEngine))
			{
				if (GameObject.FindWithTag (Tags.persistentEngine).GetComponent <StateHandler>())
				{
					stateHandler = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <StateHandler>();
				}
				
				if (GameObject.FindWithTag (Tags.persistentEngine).GetComponent <RuntimeInventory>())
				{
					runtimeInventory = GameObject.FindWithTag (Tags.persistentEngine).GetComponent <RuntimeInventory>();
				}
			}
			
			if (settingsManager.movementMethod == MovementMethod.UltimateFPS)
			{
				UltimateFPSIntegration.SetCameraState (cursorIsLocked);
			}
			
			if (settingsManager.offsetTouchCursor)
			{
				mousePosition = xboxCursor;
			}
		}
		public void SetOutput (bool autoCreate, RuntimeInventory runtimeInventory)
		{
			items = new List<InvItem>();
			activeRecipe = runtimeInventory.CalculateRecipe (autoCreate);
			if (activeRecipe != null)
			{
				foreach (InvItem assetItem in AdvGame.GetReferences ().inventoryManager.items)
				{
					if (assetItem.id == activeRecipe.resultID)
					{
						InvItem newItem = new InvItem (assetItem);
						newItem.count = 1;
						items.Add (newItem);
					}
				}
			}

			if (!autoCreate)
			{
				base.RecalculateSize ();
			}
		}
		private void OnDestroy ()
		{
			stateHandler = null;
			runtimeInventory = null;
			playerInput = null;
			playerInteraction = null;
			playerMenus = null;
		}