private void GenerateBedRock() { for (int i = 0; i < initialWorldSize; i++) { for (int j = 0; j < initialWorldSize; j++) { worldBlocks[i, 0, j] = new Block_Bedrock(new Vector3(i, 0, j)); } } }
public override void m_break(int amount) { if (breakable) { m_hardness -= 1; if (m_hardness <= 0) { Main mainscrpt = GameObject.FindObjectOfType <Main>(); mainscrpt.wg.worldBlocks[(int)index.x, (int)index.y, (int)index.z] = null; // unlocate yourself from worldblocks m_hide(); Main mainclass = GameObject.FindObjectOfType <Main>(); mainclass.wg.Draw(mainclass.transform.position); // black magic fuckery Block instance = new Block_Bedrock(Vector3.zero); // get type of child class and make an instance InventoryItem_Block item = new InventoryItem_Block(instance); // create a new inventory item of type "block" and set its refference to the type of this class(the derived class type) Inventory.AddItem(item); // add dthe inventory item to inventory } } }