2021-07-07 13:36:25 +02:00
|
|
|
|
namespace CoopServer.Entities
|
|
|
|
|
{
|
2021-08-14 21:49:23 +02:00
|
|
|
|
public class EntitiesPlayer
|
2021-07-07 13:36:25 +02:00
|
|
|
|
{
|
|
|
|
|
public string SocialClubName { get; set; }
|
|
|
|
|
public string Username { get; set; }
|
2021-08-16 12:31:49 +02:00
|
|
|
|
public float Latency { get; set; }
|
2021-08-20 17:28:13 +02:00
|
|
|
|
private LVector3 LastPosition = new();
|
|
|
|
|
private LVector3 CurrentPosition = new();
|
|
|
|
|
public LVector3 Position
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return CurrentPosition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
LastPosition = CurrentPosition;
|
|
|
|
|
CurrentPosition = value;
|
|
|
|
|
|
|
|
|
|
if (Server.GameMode != null && !LVector3.Equals(CurrentPosition, LastPosition))
|
|
|
|
|
{
|
|
|
|
|
Server.GameMode.API.InvokePlayerPositionUpdate(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsInRangeOf(LVector3 position, float distance)
|
|
|
|
|
{
|
|
|
|
|
return LVector3.Subtract(Position, position).Length() < distance;
|
|
|
|
|
}
|
2021-07-07 13:36:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|