Beispiel #1
0
    /// <summary>
    /// Performs the custom Inspector.
    /// </summary>
    public override void OnInspectorGUI()
    {
        spawn = (Spawner)target;

        if (GUILayout.Button("Unit Editor"))
        {
            SpawnerUnitEditor.Initialise(spawn);
        }
        EditorGUILayout.Space();
        if (GUILayout.Button("Wave Editor"))
        {
            SpawnerWaveEditor.Initialise(spawn);
        }
        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.PrefixLabel("Spawner ID");
            spawn.spawnID = EditorGUILayout.IntField(spawn.spawnID);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.PrefixLabel("Spawn");
            spawn.spawn = EditorGUILayout.Toggle(spawn.spawn);
        }
        EditorGUILayout.EndHorizontal();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Beispiel #2
0
    /// <summary>
    /// Initialise the Unit Editor
    /// </summary>
    /// <param name="target">The spawner to associate the editor with</param>
    public static void Initialise(Spawner target)
    {
        SpawnerUnitEditor editor = EditorWindow.GetWindow <SpawnerUnitEditor>(true, "Spawner Unit Editor", true);

        editor.spawn = target;
    }