Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Add AIActionSwapBrainNode.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosecchi committed Oct 22, 2020
1 parent 6409f75 commit 5b8a95b
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 6 deletions.
25 changes: 25 additions & 0 deletions Common/Scripts/Agents/AI/Graph/Actions/AIActionSwapBrainNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using MoreMountains.CorgiEngine;
using MoreMountains.Tools;
using TheBitCave.MMToolsExtensions.AI.Graph;
using UnityEngine;

namespace TheBitCave.CorgiExensions.AI.Graph
{
/// <summary>
/// A node representing a Corgi <see cref="MoreMountains.CorgiEngine.AIActionSwapBrain"/> action.
/// </summary>
[CreateNodeMenu("AI/Action/Swap Brain")]
public class AIActionSwapBrainNode : AIActionNode
{
public AIBrain newAIBrain;

public override AIAction AddActionComponent(GameObject go)
{
var action = go.AddComponent<AIActionSwapBrain>();
action.Label = label;
action.NewAIBrain = newAIBrain;
return action;
}

}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using TheBitCave.MMToolsExtensions.AI.Graph;
using UnityEditor;
using XNodeEditor;

namespace TheBitCave.CorgiExensions.AI.Graph
{
[CustomNodeEditor(typeof(AIActionSwapBrainNode))]
public class AIActionSwapBrainNodeEditor : AIActionNodeEditor
{
private SerializedProperty _newAIBrain;

protected override void SerializeAdditionalProperties()
{
_newAIBrain = serializedObject.FindProperty("newAIBrain");

serializedObject.Update();
NodeEditorGUILayout.PropertyField(_newAIBrain);
serializedObject.ApplyModifiedProperties();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b8a95b

Please sign in to comment.