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

Commit 0b27ecb

Browse files
committed
Add AIActionSelfDestructNode.
1 parent ab30bda commit 0b27ecb

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using MoreMountains.TopDownEngine;
2+
using MoreMountains.Tools;
3+
using TheBitCave.MMToolsExtensions.AI.Graph;
4+
using UnityEngine;
5+
6+
namespace TheBitCave.TopDownEngineExensions.AI.Graph
7+
{
8+
/// <summary>
9+
/// A node representing a TopDown Engine <see cref="MoreMountains.TopDownEngine.AIActionSelfDestruct"/> action.
10+
/// </summary>
11+
[CreateNodeMenu("AI/Action/Self Destruct")]
12+
13+
public class AIActionSelfDestructNode : AIActionNode
14+
{
15+
public bool onlyRunOnce = true;
16+
17+
public override AIAction AddActionComponent(GameObject go)
18+
{
19+
var action = go.AddComponent<AIActionSelfDestruct>();
20+
action.Label = label;
21+
action.OnlyRunOnce = onlyRunOnce;
22+
23+
return action;
24+
}
25+
}
26+
}

Common/Scripts/AI/Graph/Actions/AIActionSelfDestructNode.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using TheBitCave.MMToolsExtensions.AI.Graph;
2+
using UnityEditor;
3+
using UnityEngine;
4+
using XNodeEditor;
5+
6+
namespace TheBitCave.TopDownEngineExensions.AI.Graph
7+
{
8+
[CustomNodeEditor(typeof(AIActionSelfDestructNode))]
9+
public class AIActionSelfDestructNodeEditor : AIActionNodeEditor
10+
{
11+
private SerializedProperty _onlyRunOnce;
12+
13+
protected override void SerializeAdditionalProperties()
14+
{
15+
_onlyRunOnce = serializedObject.FindProperty("onlyRunOnce");
16+
17+
serializedObject.Update();
18+
EditorGUIUtility.labelWidth = 100;
19+
NodeEditorGUILayout.PropertyField(_onlyRunOnce);
20+
serializedObject.ApplyModifiedProperties();
21+
}
22+
}
23+
}

Common/Scripts/AI/Graph/Actions/Editor/AIActionSelfDestructNodeEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)