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

Commit

Permalink
Add AIActionSelfDestructNode.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosecchi committed Dec 31, 2021
1 parent a6c3db7 commit ace25e1
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Common/Scripts/Agents/AI/Graph/Actions/AIActionSelfDestructNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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.AIActionSelfDestruct"/> action.
/// </summary>
[CreateNodeMenu("AI/Action/Self Destruct")]
public class AIActionSelfDestructNode : AIActionNode
{
public bool onlyRunOnce = true;

public override AIAction AddActionComponent(GameObject go)
{
var action = go.AddComponent<AIActionSelfDestruct>();
action.Label = label;
action.OnlyRunOnce = onlyRunOnce;
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
Expand Up @@ -26,6 +26,5 @@ public override AIAction AddActionComponent(GameObject go)
action.TargetHandleWeapon = targetHandleWeapon;
return action;
}

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

namespace TheBitCave.CorgiExensions.AI.Graph
{
[CustomNodeEditor(typeof(AIActionSelfDestructNode))]
public class AIActionSelfDestructNodeEditor : AIActionNodeEditor
{
private SerializedProperty _onlyRunOnce;

protected override void SerializeAdditionalProperties()
{
_onlyRunOnce = serializedObject.FindProperty("onlyRunOnce");

serializedObject.Update();
EditorGUIUtility.labelWidth = 200;
NodeEditorGUILayout.PropertyField(_onlyRunOnce);
serializedObject.ApplyModifiedProperties();
}
}
}

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

0 comments on commit ace25e1

Please sign in to comment.