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

Commit 509575f

Browse files
committed
Merge branch 'develop'
2 parents 51715ea + cb8c5fe commit 509575f

17 files changed

+241
-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.AIActionMoveAwayFromTarget2D"/> action.
10+
/// </summary>
11+
[CreateNodeMenu("AI/Action/2D/Move Away From Target")]
12+
public class AIActionMoveAwayFromTarget2DNode : AIActionNode
13+
{
14+
public float maximumDistance = 5.0f;
15+
16+
public override AIAction AddActionComponent(GameObject go)
17+
{
18+
var action = go.AddComponent<AIActionMoveAwayFromTarget2D>();
19+
action.Label = label;
20+
action.MaximumDistance = maximumDistance;
21+
22+
return action;
23+
}
24+
}
25+
}

Common/Scripts/AI/Graph/Actions/AIActionMoveAwayFromTarget2DNode.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: 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.AIActionMoveAwayFromTarget3D"/> action.
10+
/// </summary>
11+
[CreateNodeMenu("AI/Action/3D/Move Away From Target")]
12+
public class AIActionMoveAwayFromTarget3DNode : AIActionNode
13+
{
14+
public float maximumDistance = 10.0f;
15+
16+
public override AIAction AddActionComponent(GameObject go)
17+
{
18+
var action = go.AddComponent<AIActionMoveAwayFromTarget3D>();
19+
action.Label = label;
20+
action.MaximumDistance = maximumDistance;
21+
22+
return action;
23+
}
24+
}
25+
}

Common/Scripts/AI/Graph/Actions/AIActionMoveAwayFromTarget3DNode.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: 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/AIActionShoot2DNode.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ namespace TheBitCave.TopDownEngineExensions.AI.Graph
1111
[CreateNodeMenu("AI/Action/2D/Shoot")]
1212
public class AIActionShoot2DNode : AIActionNode
1313
{
14+
// [Header("Binding")]
15+
// public CharacterHandleWeapon targetHandleWeaponAbility;
16+
17+
[Header("Behaviour")]
18+
public AIActionShoot2D.AimOrigins aimOrigin = AIActionShoot2D.AimOrigins.Transform;
1419
public bool faceTarget = true;
1520
public bool aimAtTarget = false;
1621

1722
public override AIAction AddActionComponent(GameObject go)
1823
{
1924
var action = go.AddComponent<AIActionShoot2D>();
25+
// action.TargetHandleWeaponAbility = targetHandleWeaponAbility;
26+
action.AimOrigin = aimOrigin;
2027
action.FaceTarget = faceTarget;
2128
action.AimAtTarget = aimAtTarget;
2229
action.Label = label;

Common/Scripts/AI/Graph/Actions/AIActionShoot3DNode.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ namespace TheBitCave.TopDownEngineExensions.AI.Graph
1111
[CreateNodeMenu("AI/Action/3D/Shoot")]
1212
public class AIActionShoot3DNode : AIActionNode
1313
{
14+
// [Header("Binding")]
15+
// public CharacterHandleWeapon targetHandleWeaponAbility;
16+
17+
[Header("Behaviour")]
1418
public bool aimAtTarget = false;
1519
public Vector3 shootOffset;
1620
public bool lockVerticalAim = false;
1721

1822
public override AIAction AddActionComponent(GameObject go)
1923
{
2024
var action = go.AddComponent<AIActionShoot3D>();
25+
// action.TargetHandleWeaponAbility = targetHandleWeaponAbility;
2126
action.AimAtTarget = aimAtTarget;
2227
action.ShootOffset = shootOffset;
2328
action.LockVerticalAim = lockVerticalAim;

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(AIActionMoveAwayFromTarget2DNode))]
9+
public class AIActionMoveAwayFromTarget2DNodeEditor : AIActionNodeEditor
10+
{
11+
private SerializedProperty _maximumDistance;
12+
13+
protected override void SerializeAdditionalProperties()
14+
{
15+
_maximumDistance = serializedObject.FindProperty("maximumDistance");
16+
17+
serializedObject.Update();
18+
EditorGUIUtility.labelWidth = 150;
19+
NodeEditorGUILayout.PropertyField(_maximumDistance);
20+
serializedObject.ApplyModifiedProperties();
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)