| | 1 | | using System; |
| | 2 | | using DCL.ECSRuntime; |
| | 3 | |
|
| | 4 | | namespace DCL.ECSComponents |
| | 5 | | { |
| | 6 | | public class AnimatorRegister : IDisposable |
| | 7 | | { |
| | 8 | | private readonly ECSComponentsFactory factory; |
| | 9 | | private readonly IECSComponentWriter componentWriter; |
| | 10 | | private readonly int componentId; |
| | 11 | |
|
| 21 | 12 | | public AnimatorRegister(int componentId, ECSComponentsFactory factory, IECSComponentWriter componentWriter) |
| | 13 | | { |
| 21 | 14 | | factory.AddOrReplaceComponent(componentId, AnimatorSerializer.Deserialize, () => new AnimatorComponentHandle |
| 21 | 15 | | componentWriter.AddOrReplaceComponentSerializer<PBAnimator>(componentId, AnimatorSerializer.Serialize); |
| | 16 | |
|
| 21 | 17 | | this.factory = factory; |
| 21 | 18 | | this.componentWriter = componentWriter; |
| 21 | 19 | | this.componentId = componentId; |
| 21 | 20 | | } |
| | 21 | |
|
| | 22 | | public void Dispose() |
| | 23 | | { |
| 2 | 24 | | factory.RemoveComponent(componentId); |
| 2 | 25 | | componentWriter.RemoveComponentSerializer(componentId); |
| 2 | 26 | | } |
| | 27 | | } |
| | 28 | | } |