MethodName to nameof()
parent
dc5c06dafa
commit
316c9e8bc4
|
@ -36,11 +36,10 @@ public partial class PursueState : ThinkerState
|
||||||
NPC.Target = NPC.GlobalPosition.DirectionTo(pos);
|
NPC.Target = NPC.GlobalPosition.DirectionTo(pos);
|
||||||
NPC.LastSeenPosition = 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;
|
return AttackState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,11 +47,9 @@ public partial class PursueState : ThinkerState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// go to last seen position of last best target
|
// go to last seen position of last best target
|
||||||
GD.Print("Last seen " + NPC.LastSeenPosition);
|
|
||||||
NavigationAgent.TargetPosition = NPC.LastSeenPosition;
|
NavigationAgent.TargetPosition = NPC.LastSeenPosition;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
return PassiveState ?? base.Think();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ThinkerState PhysicsProcess(double delta)
|
public override ThinkerState PhysicsProcess(double delta)
|
||||||
|
|
|
@ -97,7 +97,7 @@ public partial class World : Node
|
||||||
EventBus = this.GetEventBus();
|
EventBus = this.GetEventBus();
|
||||||
EventBus.RequestMoveToArea += (Events.RequestAreaArgs args) =>
|
EventBus.RequestMoveToArea += (Events.RequestAreaArgs args) =>
|
||||||
{
|
{
|
||||||
CallDeferred(MethodName.MoveToArea, args.Area, args.Connector);
|
CallDeferred(nameof(MoveToArea), args.Area, args.Connector);
|
||||||
};
|
};
|
||||||
EventBus.RegisteredBoss += RegisterBoss;
|
EventBus.RegisteredBoss += RegisterBoss;
|
||||||
EventBus.DeregisteredBoss += DeregisterBoss;
|
EventBus.DeregisteredBoss += DeregisterBoss;
|
||||||
|
|
Loading…
Reference in New Issue