private void OnGUI() { enemyScriptable = (EnemyConfig)EditorGUILayout.ObjectField(enemyScriptable, typeof(EnemyConfig), false); if (GUI.Button(new Rect(30, 30, 50, 30), "Load")) { EnemyEditorWindow enemyEditorWindow = (EnemyEditorWindow)GetWindow(typeof(EnemyEditorWindow)); if (enemyScriptable != null) { enemyEditorWindow.enemyName = enemyScriptable.enemyName; enemyEditorWindow.health = enemyScriptable.health; enemyEditorWindow.damage = enemyScriptable.damage; enemyEditorWindow.speed = enemyScriptable.speed; enemyEditorWindow.melee = enemyScriptable.melee; enemyEditorWindow.flyMonster = enemyScriptable.flyMonster; enemyEditorWindow.head = enemyScriptable.head; enemyEditorWindow.body = enemyScriptable.body; enemyEditorWindow.leftArm = enemyScriptable.leftArm; enemyEditorWindow.rightArm = enemyScriptable.rightArm; } enemyEditorWindow.Show(); Close(); } }
//public MonsterConfig monster; public static void OpenWindow() { EnemyEditorWindow enemyWindow = (EnemyEditorWindow)GetWindow(typeof(EnemyEditorWindow)); enemyWindow.wantsMouseMove = true; enemyWindow.Show(); }
/// <summary> /// Estetica general de la ventana y botones para crear/cargar los niveles. /// </summary> private void OnGUI() { minSize = new Vector2(300, 200); maxSize = minSize; //------------------------------------------- EditorGUILayout.Space(); EditorGUILayout.LabelField("ENEMIES EDITOR", _style1); EditorGUILayout.Space(); EditorGUI.DrawRect(GUILayoutUtility.GetRect(100, 2), Color.black); //------------------------------------------- bool createEnemy = GUI.Button(new Rect(75, 50, 150, 50), "Create a Enemy"); if (createEnemy) { EnemyEditorWindow levelConfig = (EnemyEditorWindow)GetWindow(typeof(EnemyEditorWindow)); levelConfig.Show(); Close(); } //------------------------------------------- bool loadEnemy = GUI.Button(new Rect(75, 110, 150, 50), "Load Enemy"); if (loadEnemy) { EnemyLoadWindow levelLoader = (EnemyLoadWindow)GetWindow(typeof(EnemyLoadWindow)); levelLoader.Show(); Close(); } }