private void ChangeToBlock() { levels = GameObject.FindGameObjectWithTag("Levels"); Vector3 pos = Selection.activeGameObject.transform.position; pos.y += 0.048f; MoveAbleBlock blo = Instantiate(moveAblePref, pos, Quaternion.identity, levels.transform); blo.Setup(moveAmount * scalex, blockColor); }
private void OnGUI() { gridPrefab = EditorGUILayout.ObjectField("Grid Prefab:", gridPrefab, typeof(Cube), true) as Cube; cubePrefab = EditorGUILayout.ObjectField("Cube Prefab:", cubePrefab, typeof(GameObject), true) as GameObject; moveAblePref = EditorGUILayout.ObjectField("Mova Able Prefab", moveAblePref, typeof(MoveAbleBlock), true) as MoveAbleBlock; constBlock = EditorGUILayout.ObjectField("Const Block", constBlock, typeof(GameObject), true) as GameObject; playerCube = EditorGUILayout.ObjectField("Player Prefab", playerCube, typeof(PlayerCube), true) as PlayerCube; playerColor = EditorGUILayout.ColorField("Player Color", playerColor); blockColor = EditorGUILayout.ColorField("Block Color", blockColor); highlightColor = EditorGUILayout.ColorField("Highlight color", highlightColor); moveAmount = EditorGUILayout.IntField("Move amount: ", moveAmount); row = EditorGUILayout.IntField("Row: ", row); column = EditorGUILayout.IntField("Column: ", column); stageNum = EditorGUILayout.IntField("Stage Number: ", stageNum); if (GUILayout.Button("Generate")) { GenerateLevel(); } if (GUILayout.Button("Change To grid")) { ChangetoGrid(); } if (GUILayout.Button("Change To Wall")) { ChangeToWall(); } if (GUILayout.Button("ADD Block")) { ChangeToBlock(); } if (GUILayout.Button("Const Block")) { CreateConstBlock(); } if (GUILayout.Button("Create Player")) { Createplayer(); } }