forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerListBufferEntry.cs
More file actions
25 lines (23 loc) · 1.05 KB
/
Copy pathPlayerListBufferEntry.cs
File metadata and controls
25 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using Unity.Entities;
namespace Unity.NetCode.Samples.PlayerList
{
/// <summary>
/// Similar to <see cref="PlayerListEntry"/>, except a <see cref="IBufferElementData"/>, allowing the client to store this data in a buffer.
/// Stores all players and their state (username, ping etc).
/// Index mapped to NetworkId - 1.
/// </summary>
/// <remarks>
/// This is therefore automatically sorted and deterministic.
/// Will contain disconnected players whose NetworkId has not been re-used.
/// Will also contain default entries as the list is resized with some spare capacity.
/// Depends on the implicit rules of NetworkId's.
/// A list is used to allow implicit resizing without having to dispose.
/// </remarks>
public struct PlayerListBufferEntry : IBufferElementData
{
/// <summary>Stores the last received RPC for this player.</summary>
public PlayerListEntry.ChangedRpc State;
public bool IsCreated => State.NetworkId != default;
}
}