Ejemplo n.º 1
0
    public ExposedDelegateEditor(UtilityAIActionEditor utilityAIActionEditor, ExposedDelegate exposedDelegate)
    {
        this.utilityAIActionEditor = utilityAIActionEditor;
        this.exposedDelegate       = exposedDelegate;

        VisualTreeAsset visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/UtilityAI/Scripts/Editor/Exposed Delegate Editor/ExposedDelegateEditor.uxml");

        visualTree.CloneTree(this);

        StyleSheet stylesheet = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/UtilityAI/Scripts/Editor/Exposed Delegate Editor/ExposedDelegateEditor.uss");

        this.styleSheets.Add(stylesheet);

        this.AddToClassList("exposedDelegateEditor");

        Button btnAddDelegateEntry = this.Query <Button>("btnAddNewMethod").First();

        btnAddDelegateEntry.BringToFront();
        btnAddDelegateEntry.clickable.clicked += AddDelegateEntry;

        Button btnRemoveAllDelegateEntries = this.Query <Button>("btnRemoveAllMethods").First();

        btnRemoveAllDelegateEntries.BringToFront();
        btnRemoveAllDelegateEntries.clickable.clicked += RemoveAllDelegateEntries;

        delegateEntriesList = this.Query <Foldout>("delegateEntries");
        delegateEntriesList.Query <Toggle>().First().AddToClassList("delegateEntryFoldout");

        delegateEntriesContainer = delegateEntriesList.Query <VisualElement>("delegateEntriesContainer").First();

        UpdateDelegateEntries();
    }
Ejemplo n.º 2
0
 public ExposedDelegate(ExposedDelegate exposedDelegate)
 {
     this.delegateEntries = new List <DelegateEntry>();
     foreach (DelegateEntry delegateEntry in exposedDelegate.delegateEntries)
     {
         this.delegateEntries.Add(new DelegateEntry(delegateEntry));
     }
 }
Ejemplo n.º 3
0
 public UtilityAIAction(UtilityAIAction action)
 {
     this.name           = action.name;
     this.enabled        = action.enabled;
     this.action         = new ExposedDelegate(action.action);
     this.considerations = new List <UtilityAIConsideration>();
     foreach (UtilityAIConsideration consideration in action.considerations)
     {
         this.considerations.Add(new UtilityAIConsideration(consideration));
     }
 }
Ejemplo n.º 4
0
 public UtilityAIAction()
 {
     name           = "New Utility AI Action";
     action         = new ExposedDelegate();
     considerations = new List <UtilityAIConsideration>();
 }