UI and button click functions for scene loading
This commit is contained in:
		
							parent
							
								
									50eaf8804a
								
							
						
					
					
						commit
						66ad5d9e10
					
				| @ -1,20 +1,20 @@ | |||||||
| Tree("Root") { | Tree("Root") { | ||||||
|    Composite(Race) { |     Composite(Race) { | ||||||
|       Composite(Sequence) { |         Composite(Sequence) { | ||||||
|          // Story A: Einkaufen und Picknicken |             // Story A: Einkaufen und Picknicken | ||||||
|          BTC.GetKeyDown("Tab") |             BTC.GetKeyDown("Tab") | ||||||
|          BTC.Run("LoadScene.Next.20SBB") |             BTC.Run("LoadScene.Next.20SBB") | ||||||
|       } |         } | ||||||
|       Composite(Sequence) { |         Composite(Sequence) { | ||||||
|          // Story B: Grotto Kochen und Essen |             // Story B: Grotto Kochen und Essen | ||||||
|          BTC.GetKeyDown("Space") |             BTC.GetKeyDown("Space") | ||||||
|          BTC.Run("LoadScene.Next.30SBB") |             BTC.Run("LoadScene.Next.30SBB") | ||||||
|       } |         } | ||||||
|       Composite(Sequence) { |         Composite(Sequence) { | ||||||
|          // Story C: Wandern im Cavaglia |             // Story C: Wandern im Cavaglia | ||||||
|          BTC.GetKeyDown("Backspace") |             BTC.GetKeyDown("Backspace") | ||||||
|          BTC.Run("LoadScene.Next.40SBB") |             BTC.Run("LoadScene.Next.40SBB") | ||||||
|       } |         } | ||||||
|    } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,8 +1,8 @@ | |||||||
| Tree("Root") { | Tree("Root") { | ||||||
|    Composite(Sequence) { |      Composite(Sequence) { | ||||||
|       // Repeat: back to 1.0 SBB |         // Repeat: back to 1.0 SBB | ||||||
|       BTC.GetKeyDown("Return") |         BTC.GetKeyDown("Return") | ||||||
|       BTC.Run("LoadScene.Next.10SBB") |         BTC.Run("LoadScene.Next.10SBB") | ||||||
|    } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ public class NamedEventTrigger : ComponentHandler { | |||||||
| 
 | 
 | ||||||
|     public override string ContentLabel() { |     public override string ContentLabel() { | ||||||
|         UpdateComponent(); |         UpdateComponent(); | ||||||
|         return ""; |         return objName; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public override void UpdateComponent() { |     public override void UpdateComponent() { | ||||||
| @ -48,6 +48,8 @@ public class NamedEventTrigger : ComponentHandler { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public string objName = "ButtonXY"; | ||||||
|  | 
 | ||||||
|     EventTrigger eventTrigger; |     EventTrigger eventTrigger; | ||||||
| 
 | 
 | ||||||
|     private bool triggered = false; |     private bool triggered = false; | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								Viagg-io/Assets/Prefabs/UI.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Viagg-io/Assets/Prefabs/UI.meta
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 98b0259e801c04bc2af79c596e2ab536 | ||||||
|  | folderAsset: yes | ||||||
|  | DefaultImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
| @ -1 +1 @@ | |||||||
| 2024-04-26T14:52:17.3584250Z | 2024-06-03T15:15:55.6795670Z | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										25
									
								
								Viagg-io/Assets/Scripts/LoadScene.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Viagg-io/Assets/Scripts/LoadScene.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | using System.Collections; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using UnityEngine; | ||||||
|  | using UnityEngine.SceneManagement; | ||||||
|  | 
 | ||||||
|  | public class LoadScene : MonoBehaviour | ||||||
|  | { | ||||||
|  |     public LoadSceneMode loadSceneMode = LoadSceneMode.Single; | ||||||
|  | 
 | ||||||
|  |     public void OnClickLoadScene(string sceneName) | ||||||
|  |     { | ||||||
|  |         StartCoroutine(LoadYourAsyncScene(sceneName)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     IEnumerator LoadYourAsyncScene(string sceneName) | ||||||
|  |     { | ||||||
|  |         AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, loadSceneMode); | ||||||
|  | 
 | ||||||
|  |         // Wait until the asynchronous scene fully loads | ||||||
|  |         while (!asyncLoad.isDone) | ||||||
|  |         { | ||||||
|  |             yield return null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								Viagg-io/Assets/Scripts/LoadScene.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Viagg-io/Assets/Scripts/LoadScene.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | |||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 8a02dc30496e7423a8975149cb40fdbe | ||||||
|  | MonoImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   defaultReferences: [] | ||||||
|  |   executionOrder: 0 | ||||||
|  |   icon: {instanceID: 0} | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
							
								
								
									
										14
									
								
								Viagg-io/Assets/Scripts/ToggleSceneUI.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Viagg-io/Assets/Scripts/ToggleSceneUI.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | using System.Collections; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using UnityEngine; | ||||||
|  | 
 | ||||||
|  | public class ToggleSceneUI : MonoBehaviour | ||||||
|  | { | ||||||
|  |     [SerializeField] | ||||||
|  |     GameObject SceneUI; | ||||||
|  | 
 | ||||||
|  |     public void ToggleUI() | ||||||
|  |     { | ||||||
|  |         SceneUI.SetActive(!SceneUI.activeSelf); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								Viagg-io/Assets/Scripts/ToggleSceneUI.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Viagg-io/Assets/Scripts/ToggleSceneUI.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | |||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: b42b16f6277c14821bce679ca29063c0 | ||||||
|  | MonoImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   defaultReferences: [] | ||||||
|  |   executionOrder: 0 | ||||||
|  |   icon: {instanceID: 0} | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
| @ -140,6 +140,8 @@ PlayerSettings: | |||||||
|   bundleVersion: 0.1 |   bundleVersion: 0.1 | ||||||
|   preloadedAssets: |   preloadedAssets: | ||||||
|   - {fileID: 11400000, guid: be340e3c48769439d8d18a5a2bccd498, type: 2} |   - {fileID: 11400000, guid: be340e3c48769439d8d18a5a2bccd498, type: 2} | ||||||
|  |   - {fileID: -8196854396901781169, guid: 1a4c68ca72a83449f938d669337cb305, type: 2} | ||||||
|  |   - {fileID: -64324148185763206, guid: a9a6963505ddf7f4d886008c6dc86122, type: 2} | ||||||
|   metroInputSource: 0 |   metroInputSource: 0 | ||||||
|   wsaTransparentSwapchain: 0 |   wsaTransparentSwapchain: 0 | ||||||
|   m_HolographicPauseOnTrackingLoss: 1 |   m_HolographicPauseOnTrackingLoss: 1 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user