MethodName to nameof()

controller-support
HumanoidSandvichDispenser 2023-08-16 21:02:49 -07:00
parent dc5c06dafa
commit 316c9e8bc4
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 4 additions and 7 deletions

View File

@ -36,11 +36,10 @@ public partial class PursueState : ThinkerState
NPC.Target = NPC.GlobalPosition.DirectionTo(pos);
NPC.LastSeenPosition = pos;
if (NPC.GlobalPosition.DistanceTo(pos) < MinDistanceToTarget)
if (NPC.HasLineOfSight(bestTarget))
{
if (NPC.HasLineOfSight(bestTarget))
if (NPC.GlobalPosition.DistanceTo(pos) < MinDistanceToTarget)
{
GD.Print("To attack state");
return AttackState;
}
}
@ -48,11 +47,9 @@ public partial class PursueState : ThinkerState
else
{
// go to last seen position of last best target
GD.Print("Last seen " + NPC.LastSeenPosition);
NavigationAgent.TargetPosition = NPC.LastSeenPosition;
}
return PassiveState ?? base.Think();
return null;
}
public override ThinkerState PhysicsProcess(double delta)

View File

@ -97,7 +97,7 @@ public partial class World : Node
EventBus = this.GetEventBus();
EventBus.RequestMoveToArea += (Events.RequestAreaArgs args) =>
{
CallDeferred(MethodName.MoveToArea, args.Area, args.Connector);
CallDeferred(nameof(MoveToArea), args.Area, args.Connector);
};
EventBus.RegisteredBoss += RegisterBoss;
EventBus.DeregisteredBoss += DeregisterBoss;