public void CaptureState() { SavingBlockState savingBlockState = FindObjectOfType(typeof(SavingBlockState)) as SavingBlockState; Dictionary <string, BlockData> blocksData = savingBlockState.blocksData; BlockData blockData = new BlockData(); blockData.inventory = GetComponent <Inventory>().GetData(); Vector2Int blockPostion = new Vector2Int(Mathf.FloorToInt(transform.position.x), Mathf.FloorToInt(transform.position.y)); if (!blocksData.ContainsKey(blockPostion.ToString())) { blocksData.Add(blockPostion.ToString(), blockData); } else { blocksData[blockPostion.ToString()] = blockData; } }
void Awake() { instance = this; }