首页 > 代码库 > u3d changeTexs
u3d changeTexs
using UnityEngine;using System.Collections;using System.Collections.Generic;public class CTex : MonoBehaviour { public List<Texture2D> tx1; public int mfps; private float m_OldTime; private float m_DelTime; private int m_NowTex; // Use this for initialization void Start () { m_DelTime = 1.0f / mfps; m_OldTime = Time.time; m_NowTex = 0; } // Update is called once per frame void Update () { float NowTime = Time.time; // Debug.Log("Time.time:"+ NowTime); if (NowTime - m_OldTime >m_DelTime) { Debug.Log("NowTex:"+ m_NowTex); this.renderer.material.mainTexture = tx1[m_NowTex]; m_NowTex++; m_OldTime = NowTime; if (m_NowTex >= tx1.Count) m_NowTex = 0; } }}
list是要播放的图片序列,mfps是帧率,越大图片播放的越快,越小越慢
Time.time得到的是游戏开始运行到现在的运行时间长度,单位是秒
u3d changeTexs
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。