mirror of
https://github.com/DerTyp7/grow-ai-unity.git
synced 2025-10-30 04:47:10 +01:00
31 lines
976 B
C#
31 lines
976 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlacedObject : MonoBehaviour
|
|
{
|
|
public static PlacedObject Create(Vector3 worldPosition, Vector2Int origin, PlacedObjectTypeSO.Dir dir, PlacedObjectTypeSO placedObjectTypeSO)
|
|
{
|
|
Transform placeObjectTransform = Instantiate(placedObjectTypeSO.prefab, worldPosition, Quaternion.identity);
|
|
|
|
PlacedObject placedObject = placeObjectTransform.GetComponent<PlacedObject>();
|
|
placedObject.placedObjectTypeSO = placedObjectTypeSO;
|
|
placedObject.origin = origin;
|
|
placedObject.dir = dir;
|
|
return placedObject;
|
|
}
|
|
|
|
PlacedObjectTypeSO placedObjectTypeSO;
|
|
Vector2Int origin;
|
|
PlacedObjectTypeSO.Dir dir;
|
|
|
|
public List<Vector2Int> GetGridPositionList()
|
|
{
|
|
return placedObjectTypeSO.GetGridPositionList(origin, PlacedObjectTypeSO.Dir.Down);
|
|
}
|
|
|
|
public void DestroySelf()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
} |