forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnablePlayerListsFeatureAuthoring.cs
More file actions
32 lines (29 loc) · 1.26 KB
/
Copy pathEnablePlayerListsFeatureAuthoring.cs
File metadata and controls
32 lines (29 loc) · 1.26 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
26
27
28
29
30
31
32
using System;
using Unity.Entities;
using UnityEngine;
namespace Unity.NetCode.Samples.PlayerList
{
/// <summary>Singleton component enabling the PlayerLists feature, allowing players to query who else is connected to the server.</summary>
public struct EnablePlayerListsFeature : IComponentData
{
/// <inheritdoc cref="PlayerListNotificationBuffer" />
/// <remarks>Set to -1 to disable this feature.</remarks>
public double EventListEntryDurationSeconds;
}
[DisallowMultipleComponent]
public class EnablePlayerListsFeatureAuthoring : MonoBehaviour
{
[RegisterBinding(typeof(EnablePlayerListsFeature), "EventListEntryDurationSeconds")]
public double EventListEntryDurationSeconds;
class EnablePlayerListsFeatureBaker : Baker<EnablePlayerListsFeatureAuthoring>
{
public override void Bake(EnablePlayerListsFeatureAuthoring authoring)
{
EnablePlayerListsFeature component = default(EnablePlayerListsFeature);
component.EventListEntryDurationSeconds = authoring.EventListEntryDurationSeconds;
var entity = GetEntity(TransformUsageFlags.Dynamic);
AddComponent(entity, component);
}
}
}
}