码迷,mamicode.com
首页 > 其他好文 > 详细

PlayerTest

时间:2016-08-31 13:39:26      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

using UnityEngine;
using System.Collections;

public class PlayTest : MonoBehaviour
{

//电影纹理
public MovieTexture mov;

 

void Start()
{

audio.clip = mov.audioClip;
audio.Play();
mov.Play();

//设置电影纹理播放模式为循环
mov.loop = true;

}

void OnGUI()
{
if (GUI.Button(new Rect(310, 0, 100, 50), "2倍速播放"))
{
audio.pitch = 2f;
}

if (GUI.Button(new Rect(410, 0, 100, 50), "1倍速播放"))
{
audio.pitch = 1f;
}

GUI.DrawTexture(new Rect(0, 0, 300, 300), mov);

//绘制电影纹理
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), mov, ScaleMode.StretchToFill);

if (GUILayout.Button("播放/继续"))
{
//播放/继续播放视频
if (!mov.isPlaying)
{
mov.Play();
}

}

if (GUILayout.Button("暂停播放"))
{
//暂停播放
mov.Pause();
}

if (GUILayout.Button("停止播放"))
{
//停止播放
mov.Stop();
}
}

}

PlayerTest

标签:

原文地址:http://www.cnblogs.com/ZeroMurder/p/5825334.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!