コード例 #1
0
    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;
        }
    }
コード例 #2
0
 void Awake()
 {
     instance = this;
 }