- 最后登录
- 2017-5-15
- 注册时间
- 2012-3-1
- 阅读权限
- 90
- 积分
- 32973
  
- 纳金币
- 32806
- 精华
- 12
|
public class NewBehaviourScript : MonoBehaviour {
Object[] animLeft;
Texture2D map ;
Object[] tex ;
private int x;
private int nowFram;
private int mFrameCount;
private float fps= 10;
private float time= 0;
// Use this for initialization
void Start () {
animLeft = Resources.LoadAll("textureBG");
map = Resources.Load("Textures/1");
}
void OnGUI () {
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),map,ScaleMode.StretchToFill,***e,0);
DrawAnimation(animLeft,Rect(x,y,Screen.width,Screen.height));
x-=1;
}
void DrawAnimation (Object[] tex,Rect rect)
{
GUI.DrawTexture(rect,tex[nowFram],ScaleMode.StretchToFill,***e,0);
time +=Time.deltaTime;
if(time>=1.0/fps)
{
nowFram++;
time = 0;
if(nowFram >= mFrameCount)
{
nowFram = 0;
}
}
}
} |
|