Removed TOTU 103
This commit is contained in:
		
							
								
								
									
										52
									
								
								Assets/Scripts/UIManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Assets/Scripts/UIManager.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.EventSystems; | ||||
| using UnityEngine.UI; | ||||
|  | ||||
| public class UIManager : MonoBehaviour | ||||
| { | ||||
|     private GraphicRaycaster raycaster; | ||||
|     private PointerEventData pData; | ||||
|     private EventSystem eventSystem; | ||||
|  | ||||
|     public Transform selectionPoint; | ||||
|  | ||||
|     public static UIManager instance; | ||||
|  | ||||
|     public static UIManager Instance | ||||
|     { | ||||
|         get | ||||
|         { | ||||
|             if (instance == null) | ||||
|             { | ||||
|                 instance = FindAnyObjectByType<UIManager>(); | ||||
|             } | ||||
|             return instance; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Start is called before the first frame update | ||||
|     void Start() | ||||
|     { | ||||
|         raycaster = GetComponent<GraphicRaycaster>(); | ||||
|         eventSystem = GetComponent<EventSystem>(); | ||||
|         pData = new PointerEventData(eventSystem); | ||||
|  | ||||
|         pData.position = selectionPoint.position; | ||||
|     } | ||||
|  | ||||
|     public bool OnEntered(GameObject button) | ||||
|     { | ||||
|         List<RaycastResult> results = new List<RaycastResult>(); | ||||
|         raycaster.Raycast(pData, results); | ||||
|  | ||||
|         foreach (var result in results) | ||||
|         { | ||||
|             if (result.gameObject == button)  | ||||
|                 return true; | ||||
|         } | ||||
|  | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Ignacio Gómez Puga
					Ignacio Gómez Puga