conveyorPO

This commit is contained in:
Janis
2022-06-05 10:52:27 +02:00
parent a31c6a16dd
commit 831f1423b5
21 changed files with 473 additions and 17 deletions

View File

@@ -4,13 +4,22 @@ using UnityEngine;
public class ItemSO : ScriptableObject
{
public string id;
public string name;
public string itemName;
public GameObject prefab;
public Sprite icon;
public void Spawn(Vector3 position)
public GameObject Spawn(Vector3 position)
{
GameObject item = Instantiate(prefab, position, Quaternion.identity);
// Snap to grid
GridBuildingSystem.instance.buildingGrid.GetXY(position, out int x, out int y);
position = GridBuildingSystem.instance.buildingGrid.GetWorldPosition(x, y);
GameObject item = Instantiate(prefab, new Vector3(position.x, position.y, 0), Quaternion.identity);
item.name = name;
item.GetComponent<ItemObject>().itemSO = this;
return item;
}
}