/// <summary> /// Reverts the command for block placement. /// </summary> public override void Undo() { base.Undo(); // Free up the region that was filled. stageState.FreeRegion(rect.x, rect.y, rect.width, rect.height); // Remove the components from the GameObject. Object.Destroy(spawnedInstance.GetComponent <MeshRenderer>()); Object.Destroy(spawnedInstance.GetComponent <MeshFilter>()); Object.Destroy(spawnedInstance.GetComponent <MeshCollider>()); }
public override void Execute() { base.Execute(); stageState.FreeRegion(rect.x, rect.y, rect.width, rect.height); Object.Destroy(blockObject.GetComponent <MeshRenderer>()); Object.Destroy(blockObject.GetComponent <MeshCollider>()); Object.Destroy(blockObject.GetComponent <MeshFilter>()); }