Esempio n. 1
0
        public static T Stop <T>(this T command)
            where T : IResourcePlayCommand
        {
            IResourcePlayer resourcePlayer = command.GetPlayer();

            resourcePlayer.Stop();
            return(command);
        }
Esempio n. 2
0
        public static IEnumerator PlayCoroutine <T>(this T command, IResourcePlayer player, Action <IResourcePlayer> onStart, Action <IResourcePlayer> onFinish)
            where T : IResourcePlayCommand
        {
            float waitSeconds = command.Delay;

            while (waitSeconds > 0f)
            {
                yield return(null);

                waitSeconds -= Time.deltaTime;
                // UnityEngine.Debug.Log($"PlayCoroutine - waiting.. waitSecond:{waitSeconds}, deltaTime: {Time.deltaTime}");
            }
            // UnityEngine.Debug.Log($"PlayCoroutine - waiting done waitSecond:{waitSeconds}, deltaTime: {Time.deltaTime}");

            onStart(player);
            yield return(player.PlayCoroutine());

            onFinish(player);
            command.Dispose();
        }