NZYDissEffect.cs 963 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class NZYDissEffect : MonoBehaviour
  6. {
  7. public float tilingX = 0;
  8. public float tilingY = 0;
  9. public float offsetX = 0;
  10. public float offsetY = 0;
  11. public float diss = 0;
  12. private Material mat;
  13. private float addSize = 0;
  14. // Start is called before the first frame update
  15. void Start()
  16. {
  17. RawImage raw = this.GetComponent<RawImage>();
  18. mat = raw.material;
  19. }
  20. // Update is called once per frame
  21. void Update()
  22. {
  23. addSize = Time.deltaTime * tilingX;
  24. //float nowTwist = mat.GetFloat("_Twist");
  25. //mat.SetFloat("_Twist", nowTwist + addSize);
  26. Texture t = mat.GetTexture("_MainTex");
  27. mat.SetTextureScale("_MainTex", new Vector2(tilingX, tilingY));
  28. mat.SetTextureOffset("_MainTex", new Vector2(offsetX, offsetY));
  29. mat.SetFloat("_Diss", diss);
  30. }
  31. }