mirror of
				https://github.com/DerTyp7/industrialize-unity.git
				synced 2025-10-31 05:17:10 +01:00 
			
		
		
		
	menus
This commit is contained in:
		
							
								
								
									
										34
									
								
								Assets/Scripts/Dictionaries/Dictionary.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Assets/Scripts/Dictionaries/Dictionary.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| public abstract class Dictionary<TEntryType> : MonoBehaviour | ||||
| { | ||||
|     public List<TEntryType> entries = new List<TEntryType>(); | ||||
|  | ||||
|     public abstract TEntryType GetEntryById(string id); | ||||
|  | ||||
|     public static Dictionary<TEntryType> instance { get; private set; } | ||||
|  | ||||
|     protected virtual void Awake() | ||||
|     { | ||||
|         if (instance != null) | ||||
|         { | ||||
|             Destroy(gameObject); | ||||
|             return; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             instance = this; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void Register(TEntryType entry) | ||||
|     { | ||||
|         entries.Add(entry); | ||||
|     } | ||||
|  | ||||
|     public void Unregister(TEntryType entry) | ||||
|     { | ||||
|         entries.Remove(entry); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Janis
					Janis