forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultGhostVariants.cs
More file actions
22 lines (21 loc) · 987 Bytes
/
Copy pathDefaultGhostVariants.cs
File metadata and controls
22 lines (21 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System.Collections.Generic;
using Unity.Entities;
using Unity.Transforms;
namespace Unity.NetCode.Samples
{
/// <summary>Registers the default variants for all samples. Since multiple user-defined variants are present for the
/// Transform components, we must explicitly define a default, and how it applies to components on child entities.</summary>
[CreateBefore(typeof(TransformDefaultVariantSystem))]
sealed class DefaultGhostVariantSystem : DefaultVariantSystemBase
{
protected override void RegisterDefaultVariants(Dictionary<ComponentType, Rule> defaultVariants)
{
#if !ENABLE_TRANSFORM_V1
defaultVariants.Add(typeof(LocalTransform), Rule.OnlyParents(typeof(TransformDefaultVariant)));
#else
defaultVariants.Add(typeof(Rotation), Rule.OnlyParents(typeof(RotationDefaultVariant)));
defaultVariants.Add(typeof(Translation), Rule.OnlyParents(typeof(TranslationDefaultVariant)));
#endif
}
}
}