Removed TOTU 103
This commit is contained in:
		
							
								
								
									
										33
									
								
								Assets/Scripts/MeasuringSystem/ObjectPlacementManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Assets/Scripts/MeasuringSystem/ObjectPlacementManager.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| public class ObjectPlacementManager : MonoBehaviour | ||||
| { | ||||
|     public LineManager lineManager; // Referencia al script LineManager | ||||
|     public GameObject myPrefab; | ||||
|  | ||||
|     public void PlaceObject(Vector3 position) | ||||
|     { | ||||
|         if (!lineManager.IsPolygonClosed()) | ||||
|         { | ||||
|             Debug.Log("No se puede colocar objetos: el pol<6F>gono no est<73> cerrado."); | ||||
|             FindObjectOfType<DebugLoggerUI>().AddMessage("No se puede colocar objetos: el pol<6F>gono no est<73> cerrado."); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         List<Vector3> polygon = lineManager.GetPolygonPoints(); | ||||
|         Vector2 point2D = new Vector2(position.x, position.z); | ||||
|  | ||||
|         if (!lineManager.IsPointInPolygon(point2D, polygon)) | ||||
|         { | ||||
|             Debug.Log("El punto est<73> fuera del <20>rea permitida."); | ||||
|             FindObjectOfType<DebugLoggerUI>().AddMessage("El punto est<73> fuera del <20>rea permitida."); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Instantiate(myPrefab, position, Quaternion.identity); | ||||
|         Debug.Log("Objeto colocado dentro del <20>rea."); | ||||
|         FindObjectOfType<DebugLoggerUI>().AddMessage("Objeto colocado dentro del <20>rea."); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Ignacio Gómez Puga
					Ignacio Gómez Puga