using UnityEngine;
using System.Collections;
public class Scroll_Mapping : MonoBehaviour
{
public float ScrollSpeed = 0.5f;
float Offset;
void Update ()
{
Offset += Time.deltaTime * ScrollSpeed;
GetComponent<Renderer>().material.mainTextureOffset = new Vector2 (Offset, 0.01f);
}
}
可以用rawImage
IEnumerator ILaBa()
{
SoundManager.Instance.Play(Enums.SoundId.SoundTurntable);
float nowAngle = roll.uvRect.y;
angle = angle + Random.Range(3, 5);
Debug.Log("angle:" + angle);
Debug.Log("nowAngle:" + nowAngle);
float fullTime = 3f;
float tempTime = fullTime;
while (tempTime > 0)
{
tempTime -= Time.unscaledDeltaTime;
//nowAngle = roll.uvRect.y;
roll.uvRect = new Rect(0, Mathf.Lerp(nowAngle, angle, (fullTime-tempTime)/3f) , 1, 1);
//Debug.LogFormat("{0}, {1}, {2}", tempTime, (fullTime - tempTime) / 3f, roll.uvRect);
yield return null;
}
nowAngle -= Mathf.Floor(nowAngle);
roll.uvRect = new Rect(0, nowAngle, 1, 1);
yield return new WaitForSeconds(1.5f);
OnHide();
UIMgr.Instance.GetLayer<MainLayer>(Enums.LayerId.LayerMain).Settment();
}