예제 #1
0
        public virtual UniTask InitializeServiceAsync()
        {
            videoLoader     = Configuration.Loader.CreateLocalizableFor <VideoClip>(providerManager, localeManager);
            streamExtension = Engine.GetConfiguration <ResourceProviderConfiguration>().VideoStreamExtension;
            cancelInput     = inputManager.GetCancel();

            Player             = Engine.CreateObject <VideoPlayer>(nameof(MoviePlayer));
            Player.playOnAwake = false;
            Player.skipOnDrop  = Configuration.SkipFrames;
            #if UNITY_WEBGL && !UNITY_EDITOR
            Player.source = VideoSource.Url;
            #else
            Player.source = VideoSource.VideoClip;
            #endif
            Player.renderMode        = VideoRenderMode.APIOnly;
            Player.isLooping         = false;
            Player.audioOutputMode   = VideoAudioOutputMode.Direct;
            Player.loopPointReached += HandleLoopPointReached;

            if (Configuration.SkipOnInput && cancelInput != null)
            {
                cancelInput.OnStart += Stop;
            }

            return(UniTask.CompletedTask);
        }
예제 #2
0
 /// <summary>
 /// Providers configuration of the requested type either via configuration provider
 /// (when engine is initialized) or by loading the asset from default resources folder.
 /// </summary>
 public static T GetOrDefault <T> () where T : Configuration
 {
     if (Engine.Initialized)
     {
         return(Engine.GetConfiguration <T>());
     }
     else
     {
         return(ProjectConfigurationProvider.LoadOrDefault <T>());
     }
 }
예제 #3
0
        private void RetrieveTexture()
        {
            var renderTexture = actorType == ActorType.Character
                ? Engine.GetConfiguration <CharactersConfiguration>().GetMetadataOrDefault(actorId).RenderTexture
                : Engine.GetConfiguration <BackgroundsConfiguration>().GetMetadataOrDefault(actorId).RenderTexture;

            if (renderTexture == null)
            {
                Debug.LogError($"Failed to retrieve `{actorId}` {actorType} actor render texture: either the actor doesn't exist or the render texture is not assigned in the configuration.");
                return;
            }

            onRenderTextureRetrieved?.Invoke(renderTexture);
        }