public override void OnInspectorGUI() { if (Application.isPlaying) { return; } WallSelector myScript = (WallSelector)target; GUILayout.Label(myScript.scriptName); //if(myScript.editObj) DrawDefaultInspector(); DrawDefaultInspector(); if (myScript.selectedStyle >= 0 && myScript.selectedStyle < myScript.selector.Length) { //GUILayout.Box("Selected Prefab: " + myScript.selector[myScript.selectedStyle].selectionName); if (myScript.editObj) { for (int i = 0; i < myScript.selector.Length; i++) { if (i == myScript.selectedStyle) { GUI.color = new Color(0f, 1f, 0f); } else { GUI.color = new Color(1f, 1f, 1f); } //GUILayout.Box(i + " " + myScript.selector[i].selectionName); if (GUILayout.Button(i + " " + myScript.selector[i].selectionName)) { myScript.SelectStyle(i); } } } if (myScript.selectorNames != null && myScript.selector != null) { if (myScript.selector.Length > 0) { if (myScript.selectorNames.Length != myScript.selector.Length) { myScript.SelectorNameUpdate(); } //myScript.selectedStyle = EditorGUILayout.Popup("Select wall prefab:", myScript.selectedStyle, myScript.selectorNames); myScript.UpdateStyle(); } } } else if (myScript.selectedStyle < 0) { myScript.selectedStyle = 0; } else if (myScript.selectedStyle >= myScript.selector.Length) { myScript.selectedStyle = myScript.selector.Length - 1; } }
private void Start() { var mazeData = mazeDataProvider.GetMazeData(); mazeGrids = mazeGenerator.GenerateMaze(mazeData); wallSelector = new WallSelector(mazeGrids); Player.Create(mazeGrids.GetTile(0, 0), transform, mazeGrids); wallSelector.ResumeSelection(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); //base.OnInspectorGUI(); GUILayout.Label("Wall Select"); selected = GUILayout.Toolbar(selected, new string[] { "제거", "2", "3" }); WallSelector wall = target as WallSelector; //현재 Id와 이전 Id를 비교해서 변경 되었을 때만 실행 if (selected != wall.currentId) { wall.SetWall(selected); wall.currentId = selected; } }