Beispiel #1
0
        public static void ChangeBlock(BlockInfo info, ushort data)
        {
            info.chunk.SetBlock(info.index, data, true);
            GameObject blockObj = Instantiate(MapGenerator.GetBlockGameObj(data)) as GameObject;

            if (blockObj.GetComponent <BlockEvents>() != null)
            {
                blockObj.GetComponent <BlockEvents>().OnBlockChange(info);
            }
            Destroy(blockObj);
        }
Beispiel #2
0
        public static void DestoryBlock(BlockInfo blockInfo)
        {
            GameObject blockObj = Instantiate(MapGenerator.GetBlockGameObj(blockInfo.GetBlock())) as GameObject;

            if (blockObj.GetComponent <BlockEvents>() != null)
            {
                blockObj.GetComponent <BlockEvents>().OnBlockDestory(blockInfo);
            }
            blockInfo.chunk.SetBlock(blockInfo.index, 0, true);
            Destroy(blockObj);
        }