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

Commit b42b725

Browse files
committed
Add AIActionReload.
1 parent acef4cd commit b42b725

File tree

5 files changed

+70
-1
lines changed

5 files changed

+70
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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.AIActionReload"/> action.
10+
/// </summary>
11+
[CreateNodeMenu("AI/Action/Reload")]
12+
public class AIActionReloadNode : AIActionNode
13+
{
14+
public bool onlyReloadOnceInThisState = true;
15+
16+
public override AIAction AddActionComponent(GameObject go)
17+
{
18+
var action = go.AddComponent<AIActionReload>();
19+
action.Label = label;
20+
action.OnlyReloadOnceInThisSate = onlyReloadOnceInThisState;
21+
22+
return action;
23+
}
24+
}
25+
}

Common/Scripts/AI/Graph/Actions/AIActionReloadNode.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.

Common/Scripts/AI/Graph/Actions/Editor/AIActionAimObjectNodeEditor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ protected override void SerializeAdditionalProperties()
3838
"Game Object to Aim property is hidden. You will have to manually add it once the generator has been executed or assign it at runtime.",
3939
MessageType.Warning);
4040
}
41-
4241
}
4342
}
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(AIActionReloadNode))]
9+
public class AIActionReloadNodeEditor : AIActionNodeEditor
10+
{
11+
private SerializedProperty _onlyReloadOnceInThisState;
12+
13+
protected override void SerializeAdditionalProperties()
14+
{
15+
_onlyReloadOnceInThisState = serializedObject.FindProperty("onlyReloadOnceInThisState");
16+
17+
serializedObject.Update();
18+
EditorGUIUtility.labelWidth = 100;
19+
NodeEditorGUILayout.PropertyField(_onlyReloadOnceInThisState);
20+
serializedObject.ApplyModifiedProperties();
21+
}
22+
}
23+
}

Common/Scripts/AI/Graph/Actions/Editor/AIActionReloadNodeEditor.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)