mirror of
				https://github.com/DerTyp7/grow-ai-unity.git
				synced 2025-10-30 21:07:09 +01:00 
			
		
		
		
	a
This commit is contained in:
		| @@ -3,16 +3,17 @@ using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.Tilemaps; | ||||
|  | ||||
| public class PlacedObject : MonoBehaviour | ||||
| public abstract class PlacedObject : MonoBehaviour | ||||
| { | ||||
|     public static PlacedObject Create(Vector3 worldPosition, Vector2Int origin, PlacedObjectTypeSO.Dir dir, PlacedObjectTypeSO placedObjectTypeSO) | ||||
|     public static PlacedObject Create(Vector3 worldPosition, Vector2Int origin, PlacedObjectTypeSO placedObjectTypeSO) | ||||
|     { | ||||
|         Transform placeObjectTransform = Instantiate(placedObjectTypeSO.prefab, worldPosition, Quaternion.identity); | ||||
|  | ||||
|         PlacedObject placedObject = placeObjectTransform.GetComponent<PlacedObject>(); | ||||
|         placedObject.placedObjectTypeSO = placedObjectTypeSO; | ||||
|         placedObject.origin = origin; | ||||
|         placedObject.dir = dir; | ||||
|  | ||||
|         placedObject.OnPlace(); | ||||
|  | ||||
|         if (placedObjectTypeSO.isWalkable)  | ||||
|         { | ||||
| @@ -28,11 +29,12 @@ public class PlacedObject : MonoBehaviour | ||||
|  | ||||
|     PlacedObjectTypeSO placedObjectTypeSO; | ||||
|     Vector2Int origin; | ||||
|     PlacedObjectTypeSO.Dir dir; | ||||
|  | ||||
|     public abstract void OnPlace(); | ||||
|  | ||||
|     public List<Vector2Int> GetGridPositionList() | ||||
|     { | ||||
|         return placedObjectTypeSO.GetGridPositionList(origin, PlacedObjectTypeSO.Dir.Down); | ||||
|         return placedObjectTypeSO.GetGridPositionList(origin); | ||||
|     } | ||||
|  | ||||
|     public void DestroySelf() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 j.mei7
					j.mei7