Skip to content

Commit 2c7f36d

Browse files
committed
Git Cleanup and Working Example
1 parent 2162fd5 commit 2c7f36d

33 files changed

+2134
-30
lines changed

Assets/.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

Assets/.vs/VSWorkspaceState.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"PreviewInSolutionExplorer": false
6+
}

Assets/.vs/slnx.sqlite

72 KB
Binary file not shown.

Assets/AI/BehaviorManager.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using Assets.Scripts.AI.Components;
2-
using Assets.Scripts.AI.Tree;
32
using System;
43
using System.Collections;
54
using System.Collections.Generic;
6-
using System.IO;
75
using UnityEngine;
86
using Newtonsoft.Json;
97
using System.ComponentModel;
@@ -17,6 +15,7 @@ public class BehaviorManager : MonoBehaviour
1715
/// The file to actually save/load to/from.
1816
/// </summary>
1917
[JsonIgnore]
18+
[Description("The currently loaded tree asset that will be run.")]
2019
public BehaviorTreeManagerAsset BehaviorTreeFile;
2120

2221
/// <summary>
@@ -48,13 +47,13 @@ public ParallelRunner Runner
4847
/// Number of times to tick the full trees. Set to a negative number to make an infinitely running behavior tree.
4948
/// </summary>
5049
[SerializeField]
51-
50+
[Description("Times to tick this tree before stopping. Negative values indicate infinitely running behavior.")]
5251
public int TimesToTick = 10;
5352

54-
53+
[Description("Open a list to splice other trees into this tree.")]
5554
public bool spliceNewIntoTree = false;
5655
/// <summary>
57-
/// A list of trees to splice into the current tree. These are not directly editable.
56+
/// A list of trees to splice into the current tree. These trees are not directly editable.
5857
/// </summary>
5958
[JsonIgnore]
6059
public List<BehaviorTreeManagerAsset> SpliceList;

Assets/AI/BehaviorTreeManagerAsset.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public static ParallelRunner LoadFromJSON(this BehaviorTreeManagerAsset asset, B
4040
Type type = Assembly.GetAssembly(typeof(BehaviorTreeElement)).GetType(typeName);
4141
dynamic newBehavior = Activator.CreateInstance(type, (string)el.Name, (int)el.Depth, (int)el.ID);
4242

43-
FieldInfo[] fields = type.GetFields();
44-
4543
JsonConvert.PopulateObject(JsonConvert.SerializeObject(el), newBehavior);
4644
newElements.Add(newBehavior);
4745
}

Assets/AI/Nodes/MoveEnemyIfCloseToPlayer.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ public class MoveEnemyIfCloseToPlayer : BehaviorNode
3232
public int UpdateSelfPositionTickInterval = 5;
3333

3434
public MoveEnemyIfCloseToPlayer(string name, int depth, int id) : base(name, depth, id)
35-
{
36-
37-
}
35+
{ }
3836

3937
public override IEnumerator Tick(WaitForSeconds delayStart = null)
4038
{
@@ -55,7 +53,7 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
5553
var targetPosition = closestPlayer.position;
5654
var currentPosition = myPos.position;
5755

58-
if (Vector3.Distance(currentPosition, targetPosition) > myPos.GetComponentInParent<BoxCollider2D>().size.magnitude*2)
56+
if (Vector3.Distance(currentPosition, targetPosition) > myPos.GetComponentInParent<BoxCollider>().size.magnitude*2)
5957
{
6058
var directionOfTravel = targetPosition - currentPosition;
6159
CurrentState = BehaviorState.Running;
Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ MonoBehaviour:
1818
\ \"Depth\": -1,\r\n \"HasChildren\": true,\r\n \"Name\": \"New Root\",\r\n
1919
\ \"ID\": -1\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Components.Selector\",\r\n
2020
\ \"Depth\": 0,\r\n \"HasChildren\": true,\r\n \"Name\": \"Selector 0\",\r\n
21-
\ \"ID\": 0\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Decorators.Inverter\",\r\n
21+
\ \"ID\": 0\r\n },\r\n {\r\n \"MoveSpeed\": 2.5,\r\n \"UpdatePlayersTickInterval\":
22+
6,\r\n \"UpdateSelfPositionTickInterval\": 3,\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.MoveEnemyIfCloseToPlayer\",\r\n
23+
\ \"Depth\": 1,\r\n \"HasChildren\": false,\r\n \"Name\": \"MoveEnemyIfCloseToPlayer
24+
3\",\r\n \"ID\": 3\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Decorators.Inverter\",\r\n
2225
\ \"Depth\": 1,\r\n \"HasChildren\": true,\r\n \"Name\": \"Inverter 4\",\r\n
2326
\ \"ID\": 4\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Components.Sequencer\",\r\n
2427
\ \"Depth\": 2,\r\n \"HasChildren\": true,\r\n \"Name\": \"Sequencer 5\",\r\n
25-
\ \"ID\": 5\r\n },\r\n {\r\n \"MoveSpeed\": 2.5,\r\n \"UpdatePlayersTickInterval\":
26-
6,\r\n \"UpdateSelfPositionTickInterval\": 3,\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.MoveEnemyIfCloseToPlayer\",\r\n
27-
\ \"Depth\": 3,\r\n \"HasChildren\": false,\r\n \"Name\": \"MoveEnemyIfCloseToPlayer
28-
3\",\r\n \"ID\": 3\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.DebugOutNode\",\r\n
28+
\ \"ID\": 5\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.DebugOutNode\",\r\n
2929
\ \"Depth\": 3,\r\n \"HasChildren\": false,\r\n \"Name\": \"DebugOutNode
3030
7\",\r\n \"ID\": 7\r\n },\r\n {\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.DebugOutNode\",\r\n
3131
\ \"Depth\": 3,\r\n \"HasChildren\": false,\r\n \"Name\": \"DebugOutNode

Assets/New Terrain.asset

1.02 MB
Binary file not shown.

0 commit comments

Comments
 (0)