AirDistortController.cs 873 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using UnityEngine;
  3. [RequireComponent(typeof(SpriteRenderer))]
  4. public class AirDistortController : MonoBehaviour
  5. {
  6. private void Start()
  7. {
  8. this.srender = base.GetComponent<SpriteRenderer>();
  9. this.material = this.srender.material;
  10. this.material.SetFloat("_DispScrollSpeedX", this.X方向移动速度);
  11. this.material.SetFloat("_DispScrollSpeedY", this.Y方向移动速度);
  12. this.material.SetFloat("_StrengthX", this.X方向扭曲强度);
  13. this.material.SetFloat("_StrengthY", this.Y方向扭曲强度);
  14. this.material.SetFloat("_Strength", this.总扭曲强度);
  15. }
  16. public float X方向移动速度;
  17. public float Y方向移动速度;
  18. public float X方向扭曲强度;
  19. public float Y方向扭曲强度 = 1f;
  20. public float 总扭曲强度 = 1f;
  21. private Material material;
  22. private SpriteRenderer srender;
  23. }