Mappp
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
public sealed class AirTarget : MapTarget
|
||||
{
|
||||
protected override void TickMovement(float deltaTime)
|
||||
{
|
||||
if (Player == null || Config == null || Config.MovementSpeed <= 0f)
|
||||
return;
|
||||
|
||||
Vector2 playerCoordinates = Player.MapCoordinates;
|
||||
if (Vector2.Distance(MapCoordinates, playerCoordinates) <= Config.StoppingDistance)
|
||||
return;
|
||||
|
||||
Vector2 nextCoordinates = Vector2.MoveTowards(
|
||||
MapCoordinates,
|
||||
playerCoordinates,
|
||||
Config.MovementSpeed * deltaTime);
|
||||
SetMapCoordinates(nextCoordinates);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user