| | 1 | | using DCL; |
| | 2 | | using DCL.Emotes; |
| | 3 | | using DCLServices.WearablesCatalogService; |
| | 4 | | using GPUSkinning; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | namespace AvatarSystem |
| | 8 | | { |
| | 9 | | public class AvatarFactory : IAvatarFactory |
| | 10 | | { |
| | 11 | | private readonly ServiceLocator serviceLocator; |
| | 12 | |
|
| 425 | 13 | | public AvatarFactory(ServiceLocator serviceLocator) |
| | 14 | | { |
| 425 | 15 | | this.serviceLocator = serviceLocator; |
| 425 | 16 | | } |
| | 17 | |
|
| | 18 | | public IAvatar CreateAvatar(GameObject avatarContainer, IAnimator animator, ILOD lod, IVisibility visibility) => |
| 518 | 19 | | new Avatar( |
| | 20 | | CreateAvatarCurator(), |
| | 21 | | CreateLoader(avatarContainer), |
| | 22 | | visibility, |
| | 23 | | lod, |
| | 24 | | new SimpleGPUSkinning(), |
| | 25 | | serviceLocator.Get<IGPUSkinningThrottlerService>(), |
| | 26 | | new AvatarEmotesController(animator, serviceLocator.Get<IEmotesService>()) |
| | 27 | | ); |
| | 28 | |
|
| | 29 | | public IAvatar CreateAvatarWithHologram( |
| | 30 | | GameObject avatarContainer, |
| | 31 | | IBaseAvatar baseAvatar, |
| | 32 | | IAnimator animator, |
| | 33 | | ILOD lod, |
| | 34 | | IVisibility visibility |
| | 35 | | ) => |
| 0 | 36 | | new AvatarWithHologram( |
| | 37 | | baseAvatar, |
| | 38 | | CreateAvatarCurator(), |
| | 39 | | CreateLoader(avatarContainer), |
| | 40 | | visibility, |
| | 41 | | lod, |
| | 42 | | new SimpleGPUSkinning(), |
| | 43 | | serviceLocator.Get<IGPUSkinningThrottlerService>(), |
| | 44 | | new AvatarEmotesController(animator, serviceLocator.Get<IEmotesService>()) |
| | 45 | | ); |
| | 46 | |
|
| | 47 | | private Loader CreateLoader(GameObject avatarContainer) => |
| 518 | 48 | | new (new WearableLoaderFactory(), avatarContainer, new AvatarMeshCombinerHelper()); |
| | 49 | |
|
| | 50 | | private AvatarCurator CreateAvatarCurator() => |
| 518 | 51 | | new (new WearableItemResolver(serviceLocator.Get<IWearablesCatalogService>()), serviceLocator.Get<IEmotesCat |
| | 52 | | } |
| | 53 | | } |