This commit is contained in:
2022-10-16 18:00:32 +04:00
parent 1558b5eefb
commit 5519ae7679
4 changed files with 9 additions and 7 deletions
+1 -2
View File
@@ -15,13 +15,12 @@ public class Entity
public ushort StaticId { get; private set; }
public ushort EntityType { get; private set; }
public ushort OwnerId { get; private set; }
public byte[] Payload { get; private set; }
public RagonAuthority Authority { get; private set; }
private List<EntityProperty> _properties;
private List<EntityEvent> _bufferedEvents;
public byte[] Payload { get; set; }
public Entity(GameRoom room, ushort ownerId, ushort entityType, ushort staticId, RagonAuthority eventAuthority)
{
OwnerId = ownerId;
+3 -2
View File
@@ -36,7 +36,9 @@ namespace Ragon.Core
private List<ushort> _peersCache = new List<ushort>();
private List<ushort> _awaitingPeers = new List<ushort>();
public Player GetPlayerById(ushort peerId) => _players[peerId];
public Player GetPlayerByPeer(ushort peerId) => _players[peerId];
public Player GetPlayerById(string id) => _players.Values.FirstOrDefault(p => p.Id == id)!;
public Entity GetEntityById(int entityId) => _entities[entityId];
@@ -280,7 +282,6 @@ namespace Ragon.Core
public void Tick(float deltaTime)
{
_scheduler.Tick(deltaTime);
SendChanges();
}
+2
View File
@@ -8,5 +8,7 @@ public interface IGameRoom
public int PlayersMax { get; }
public int PlayersCount { get; }
public Player GetPlayerById(string id);
public Player GetPlayerByPeer(ushort peerId);
public Entity GetEntityById(int entityId);
}
+2 -2
View File
@@ -183,12 +183,12 @@ namespace Ragon.Core
{
}
public virtual bool OnEntityCreated(Player creator, Entity entity)
public virtual bool OnEntityCreated(Player player, Entity entity)
{
return false;
}
public virtual bool OnEntityDestroyed(Player destoyer, Entity entity)
public virtual bool OnEntityDestroyed(Player player, Entity entity)
{
return false;
}