1- using System . Collections ;
2- using BehaviourGraph . Attributes ;
1+ using BehaviourGraph . Attributes ;
32using BehaviourGraph . Services ;
43using Coffee . BehaviourTree ;
54using 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