diff options
author | chai <215380520@qq.com> | 2023-05-12 10:32:11 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-05-12 10:32:11 +0800 |
commit | 2fc9585797067730f28b03b0727bf05f9deed091 (patch) | |
tree | 8807e37b85ba922045eaa17ac445dd0a1d2d730c /WorldlineKeepers/Assets/Scripts/WaypointScript.cs | |
parent | 2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 (diff) |
+ worldline keepers
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/WaypointScript.cs')
-rw-r--r-- | WorldlineKeepers/Assets/Scripts/WaypointScript.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/WaypointScript.cs b/WorldlineKeepers/Assets/Scripts/WaypointScript.cs new file mode 100644 index 0000000..1012bc2 --- /dev/null +++ b/WorldlineKeepers/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; + } + } + + +} |