Skip to content

Commit 3dde388

Browse files
committed
Pre-context impl
1 parent d4c3af3 commit 3dde388

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Examples/ThingyController.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Collections;
2-
using BehaviourGraph.Attributes;
1+
using BehaviourGraph.Attributes;
32
using BehaviourGraph.Services;
43
using Coffee.BehaviourTree;
54
using UnityEngine;
@@ -60,10 +59,15 @@ private Vector2 GetPointInRadius(float radiusSize)
6059
return position + pointOffset;
6160
}
6261

62+
public float DistanceToPlayer()
63+
{
64+
return
65+
Vector2.Distance(playerTransform.localPosition, transform.localPosition);
66+
}
67+
6368
[Service]
6469
public ServiceState FindWaypoint()
6570
{
66-
Debug.Log("Selected new waypoint.");
6771
currentRadius = smellRadius;
6872
waypoint = GetPointInRadius(randomRadiusSize);
6973
return ServiceState.Complete;
@@ -72,7 +76,6 @@ public ServiceState FindWaypoint()
7276
[Service]
7377
public ServiceState MoveToRandomPoint()
7478
{
75-
Debug.Log("Moving");
7679
transform.localPosition = Vector2.MoveTowards(
7780
transform.localPosition, waypoint,
7881
speed * Time.deltaTime);
@@ -83,12 +86,6 @@ public ServiceState MoveToRandomPoint()
8386
}
8487
return ServiceState.Complete;
8588
}
86-
87-
public float DistanceToPlayer()
88-
{
89-
return
90-
Vector2.Distance(playerTransform.localPosition, transform.localPosition);
91-
}
9289

9390
[Service]
9491
public ServiceState ChasePlayer()

0 commit comments

Comments
 (0)