public override void OnEnter() { _player = playerType == PlayerType.ClipPlayer ? (IClipPlayer)clipPlayer : (IClipPlayer)clipPlayerUI; switch (actionType) { case ActionType.Play: var proxyClip = (AnimatedClipProxy)clip.Value; Gif.PlayClip(_player, proxyClip.clip, startDelay.Value, loop.Value); break; case ActionType.Pause: Gif.PausePlayer(_player); break; case ActionType.Resume: Gif.ResumePlayer(_player); break; case ActionType.Stop: Gif.StopPlayer(_player); break; } Finish(); }
/// <summary> /// Plays the clip on the specified clip player. /// </summary> /// <param name="player">Player.</param> /// <param name="clip">Clip.</param> /// <param name="startDelay">Optional delay before the playing starts.</param> /// <param name="loop">If set to <c>true</c> loop indefinitely.</param> public static void PlayClip(IClipPlayer player, AnimatedClip clip, float startDelay = 0, bool loop = true) { if (player == null) { Debug.LogError("Player is null."); return; } else { player.Play(clip, startDelay, loop); } }
/// <summary> /// Stops the clip player. /// </summary> /// <param name="player">Player.</param> public static void StopPlayer(IClipPlayer player) { if (player == null) { Debug.LogError("Player is null."); return; } else { player.Stop(); } }