diff options
author | chai <215380520@qq.com> | 2023-05-04 11:25:52 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-05-04 11:25:52 +0800 |
commit | 848097c88bbcf24934a375dff39cf4defa2819dd (patch) | |
tree | 85f4cc4d09fbf2a3839752449d21cb3e0bec8fa1 /marching/Assets/Scripts/WaypointScript.cs | |
parent | ba1ad0efd8601dc4af023aca5a78609c55b4d67f (diff) |
*misc
Diffstat (limited to 'marching/Assets/Scripts/WaypointScript.cs')
-rw-r--r-- | marching/Assets/Scripts/WaypointScript.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/marching/Assets/Scripts/WaypointScript.cs b/marching/Assets/Scripts/WaypointScript.cs new file mode 100644 index 0000000..1012bc2 --- /dev/null +++ b/marching/Assets/Scripts/WaypointScript.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class WaypointScript : MonoBehaviour +{ + public float life; + + // Start is called before the first frame update + void Start() + { + StartCoroutine(CoUpdate()); + } + + + IEnumerator CoUpdate() { + float t = 0; + while (true) + { + Color c = this.gameObject.GetComponent<SpriteRenderer>().color; + c.a *= 0.99f; + this.gameObject.GetComponent<SpriteRenderer>().color = c; + this.transform.localScale *= 1.002f; + t+= Time.deltaTime; + if(t > life) + { + Destroy(this.gameObject); + yield break; + } + yield return null; + } + } + + +} |