blob: 1012bc27fd2c9a30aca2d61f807febb686cd6736 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}
}
}
|