public StockpilePart(Vector2Int position, Stockpile parent) { this.position = position; this.parent = parent; gameObject = Factory.Create("stockpile part", this.position); spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); parent.AddPart(this); if (HasItem) { StockpileManager.GetInstance().AddItemToStockpiles(GetItem); } }
public void ChangeStockpiles(Stockpile newStockpile) { parent.RemovePart(this); newStockpile.AddPart(this); parent = newStockpile; }