Skip to content

Commit f8bb9e4

Browse files
committed
Reset Back To Nonrx
1 parent 1767ad0 commit f8bb9e4

File tree

10 files changed

+24
-33
lines changed

10 files changed

+24
-33
lines changed

Assets/Scripts/AI/BehaviorManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public void Reinitialize()
7878
IEnumerator Start()
7979
{
8080
WaitForSeconds wfs = new WaitForSeconds(SecondsBetweenTicks);
81-
81+
8282
Debug.Log("Starting ticks on Runner: \n\t" + Runner.ToString());
8383
yield return Runner.Tick();
84-
while (Runner.CurrentState == BehaviorState.Running && (TimesToTick != 0))
84+
while (Runner.CurrentState.Equals(BehaviorState.Running) && (TimesToTick != 0))
8585
{
8686
yield return StartCoroutine(Runner.Tick(wfs));
8787
if(TimesToTick > 0) --TimesToTick;

Assets/Scripts/AI/BehaviorTreeElement.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System;
33
using System.Collections;
44
using System.Collections.Generic;
5+
using UniRx;
56
using UnityEngine;
67

78
namespace Assets.Scripts.AI
@@ -44,24 +45,15 @@ public BehaviorTreeElement(string name, int depth, int id)
4445
: base(name, depth, id)
4546
{
4647
ElementType = this.GetType().ToString();
47-
_CurrentState = BehaviorState.Null;
48+
CurrentState = (BehaviorState.Null);
4849
Children = new List<TreeElement>();
4950
}
5051

51-
private BehaviorState _CurrentState;
52+
5253
[Newtonsoft.Json.JsonIgnore]
53-
public BehaviorState CurrentState
54-
{
55-
get
56-
{
57-
return _CurrentState;
58-
}
59-
protected set
60-
{
61-
_CurrentState = value;
54+
public BehaviorState CurrentState;
6255

63-
}
64-
}
56+
6557

6658
public virtual IEnumerator Tick(WaitForSeconds delayStart = null)
6759
{

Assets/Scripts/AI/Components/BehaviorComponent.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@ public virtual void AddChild(BehaviorTreeElement element)
2121
element.BehaviorTreeManager = BehaviorTreeManager;
2222
Children.Add(element);
2323
}
24-
25-
2624
}
2725
}

Assets/Scripts/AI/Components/ParallelRunner.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public ParallelRunner(string name, int depth, int id)
3131
public override IEnumerator Tick(WaitForSeconds delayStart = null)
3232
{
3333
yield return delayStart;
34-
CurrentState = BehaviorState.Running;
34+
CurrentState = (BehaviorState.Running);
3535
if (Children == null || Children.Count <=0)
3636
{
3737
Debug.LogWarning("Children Null in parallel runner");
38-
CurrentState = BehaviorState.Null;
38+
CurrentState = (BehaviorState.Null);
3939
yield return null;
4040
}
4141

@@ -49,7 +49,7 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
4949
++NumberOfFailures;
5050
if(NumberOfFailures >= NumberOfFailuresBeforeFail)
5151
{
52-
CurrentState = BehaviorState.Fail;
52+
CurrentState = (BehaviorState.Fail);
5353
yield break;
5454
}
5555
}
@@ -60,12 +60,12 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
6060
++NumberOfSuccesses;
6161
if (NumberOfSuccesses >= NumberOfSuccessBeforeSucceed)
6262
{
63-
CurrentState = BehaviorState.Success;
63+
CurrentState = (BehaviorState.Success);
6464
yield break;
6565
}
6666
}
6767
Debug.LogWarning("Ending Parallel Tick in Run State.");
68-
CurrentState = BehaviorState.Running;
68+
CurrentState = (BehaviorState.Running);
6969
yield return null;
7070
}
7171
}

Assets/Scripts/AI/Components/Selector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public override IEnumerator Tick(UnityEngine.WaitForSeconds delayStart = null)
2121
base.Tick();
2222
UnityEngine.Debug.LogError("Selector START");
2323

24-
CurrentState = BehaviorState.Running;
24+
CurrentState = (BehaviorState.Running);
2525
foreach (BehaviorTreeElement behavior in Children)
2626
{
2727
yield return BehaviorTreeManager.StartCoroutine(behavior.Tick());

Assets/Scripts/AI/Decorators/Inverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public override IEnumerator Tick(WaitForSeconds delaySTart = null)
2020
switch (behavior.CurrentState)
2121
{
2222
case BehaviorState.Fail:
23-
this.CurrentState = BehaviorState.Success;
23+
this.CurrentState = (BehaviorState.Success);
2424
break;
2525
case BehaviorState.Success:
26-
CurrentState = BehaviorState.Fail;
26+
CurrentState = (BehaviorState.Fail);
2727
break;
2828
case BehaviorState.Running:
29-
this.CurrentState = BehaviorState.Running;
29+
this.CurrentState = (BehaviorState.Running);
3030
break;
3131
default:
3232
Debug.LogError("Something went wrong in an inverter.");

Assets/Scripts/AI/Nodes/DebugOutNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
1717
Debug.Log(Name + "node starting... waiting...");
1818
yield return delayStart;
1919
Debug.Log("BEHAVIOR NODE DOIN THE THANG!");
20-
CurrentState = BehaviorState.Success;
20+
CurrentState = (BehaviorState.Success);
2121
yield return null;
2222
}
2323
}

Assets/Scripts/AI/Nodes/MoveEnemyIfCloseToPlayer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
5656
if (Vector3.Distance(currentPosition, targetPosition) > myPos.GetComponentInParent<BoxCollider>().size.magnitude*2)
5757
{
5858
var directionOfTravel = targetPosition - currentPosition;
59-
CurrentState = BehaviorState.Running;
59+
CurrentState = (BehaviorState.Running);
6060
float step = (MoveSpeed / directionOfTravel.magnitude) * Time.fixedDeltaTime;
6161
float t = 0;
6262
while (t <= 1.0f)
@@ -66,11 +66,11 @@ public override IEnumerator Tick(WaitForSeconds delayStart = null)
6666
yield return new WaitForFixedUpdate(); // Leave the routine and return here in the next frame
6767
}
6868
}
69-
CurrentState = BehaviorState.Success;
69+
CurrentState = (BehaviorState.Success);
7070
yield return null;
7171
}
7272

73-
CurrentState = BehaviorState.Success;
73+
CurrentState = (BehaviorState.Success);
7474
yield return null;
7575
}
7676

Assets/Scripts/AI/Tree/TreeElement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Newtonsoft.Json;
22
using System;
33
using System.Collections.Generic;
4+
using UniRx;
45
using UnityEngine;
56

67
namespace Assets.Scripts.AI.Tree
@@ -60,5 +61,4 @@ public TreeElement (string name, int depth, int id)
6061
_Depth = depth;
6162
}
6263
}
63-
6464
}

Assets/Scripts/AI/Tree/TreeElementUtility.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using UniRx;
45

56
namespace Assets.Scripts.AI.Tree
67
{
@@ -68,8 +69,8 @@ public static T ListToTree<T>(IList<T> list) where T : TreeElement
6869
break;
6970
}
7071

71-
// Fill child array
72-
List<TreeElement> childList = null;
72+
// Fill child array
73+
List<TreeElement> childList = null;
7374
if (childCount != 0)
7475
{
7576
childList = new List<TreeElement>(childCount); // Allocate once

0 commit comments

Comments
 (0)