F3DBurnoutExample.cs 562 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using System.Collections;
  3. public class F3DBurnoutExample : MonoBehaviour {
  4. MeshRenderer[] turretParts;
  5. int BurnoutID;
  6. // Use this for initialization
  7. void Start () {
  8. BurnoutID = Shader.PropertyToID("_BurnOut");
  9. turretParts = GetComponentsInChildren<MeshRenderer>();
  10. }
  11. // Update is called once per frame
  12. void Update () {
  13. for(int i = 0; i < turretParts.Length; i++)
  14. {
  15. turretParts[i].material.SetFloat(BurnoutID, Mathf.Lerp(0, 2f, (Mathf.Sin(Time.time)) / 2));
  16. }
  17. }
  18. }