You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
705 B
34 lines
705 B
using UnityEngine; |
|
using System.Collections; |
|
|
|
public class BurnHelper : MonoBehaviour { |
|
|
|
public Material material; |
|
|
|
[Range(0.01f, 1.0f)] |
|
public float burnSpeed = 0.3f; |
|
|
|
private float burnAmount = 0.0f; |
|
|
|
// Use this for initialization |
|
void Start () { |
|
if (material == null) { |
|
Renderer renderer = gameObject.GetComponentInChildren<Renderer>(); |
|
if (renderer != null) { |
|
material = renderer.material; |
|
} |
|
} |
|
|
|
if (material == null) { |
|
this.enabled = false; |
|
} else { |
|
material.SetFloat("_BurnAmount", 0.0f); |
|
} |
|
} |
|
|
|
// Update is called once per frame |
|
void Update () { |
|
burnAmount = Mathf.Repeat(Time.time * burnSpeed, 1.0f); |
|
material.SetFloat("_BurnAmount", burnAmount); |
|
} |
|
}
|
|
|