FlowDirectionControl.cs 404 B

12345678910111213141516
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class FlowDirectionControl : MonoBehaviour
  5. {
  6. public Material mat;
  7. public Vector2 direction = new Vector2(1, 1); // 斜向右上
  8. public float speed = 1f;
  9. void Update()
  10. {
  11. mat.SetVector("_FlowDir", direction.normalized);
  12. mat.SetFloat("_FlowSpeed", speed);
  13. }
  14. }