2022-05-22 15:55:26 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using GTA;
|
2022-05-23 15:27:51 +08:00
|
|
|
|
using GTA.Math;
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
namespace RageCoop.Client
|
|
|
|
|
{
|
|
|
|
|
public class SyncedEntity
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Indicates whether the current player is responsible for syncing this entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsMine
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return OwnerID==Main.MyPlayerID;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int ID { get; set; }
|
|
|
|
|
public int OwnerID { get;set; }
|
|
|
|
|
public bool IsOutOfSync
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Main.Ticked-LastSynced>200;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#region LAST STATE
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Last time a new sync message arrived.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ulong LastSynced { get; set; } = 0;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Last time a new sync message arrived.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ulong LastStateSynced { get; internal set; } = 0;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Last time the local entity has been updated,
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ulong LastUpdated { get; set; } = 0;
|
|
|
|
|
#endregion
|
|
|
|
|
|
2022-05-23 15:27:51 +08:00
|
|
|
|
public Vector3 Position { get; set; }
|
|
|
|
|
public Vector3 Rotation { get; set; }
|
|
|
|
|
public Vector3 Velocity { get; set; }
|
|
|
|
|
|
2022-05-22 15:55:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|